OPEN-SOURCE SCRIPT
ที่อัปเดต:

Machine Learning Price Predictor: Ridge AR [Bitwardex]

392
🔹Machine Learning Price Predictor: Ridge AR is a research-oriented indicator demonstrating the use of Regularized AutoRegression (Ridge AR) for short-term price forecasting.
The model combines autoregressive structure with Ridge regularization, providing stability under noisy or volatile market conditions.
The latest version introduces Bull and Bear signals, visually representing the current momentum phase and model direction directly on the chart.

Unlike traditional linear regression, Ridge AR minimizes overfitting, stabilizes coefficient dynamics, and enhances predictive consistency in correlated datasets.

The script plots:
  • Fit Line — in-sample fitted data;
  • Forecast Line — out-of-sample projection;
  • Trend Segments — color-coded bullish/bearish sections;
  • Bull/Bear Labels 🐂🐻 — dynamic visual signals showing directional bias.


Designed for researchers, students, and developers, this tool helps explore regularized time-series forecasting in Pine Script™.

🧩 Ridge AR Settings
  • Training Window — number of bars used for model training;
  • Forecast Horizon — forecast length (bars ahead);
  • AR Order — number of lags used as features;
  • Ridge Strength (λ) — regularization coefficient;
  • Damping Factor — exponential trend decay rate;
  • Trend Length — period for trend/volatility estimation;
  • Momentum Weight — strength of the recent move;
  • Mean Reversion — pullback intensity toward the mean.


🧮 Data Processing
  • Prefilter:None — raw close price;
    EMA — exponential smoothing;
    SuperSmoother — Ehlers filter for noise reduction.
  • EMA Length, SuperSmoother Length — smoothing parameters.


🖥️ Display Settings
  • Update Mode:Lock — static model;
    Update Once Reached — rebuild after forecast horizon;
    Continuous— update every bar.
  • Forecast Color — projection line color;
  • Bullish/Bearish Colors — colors for trend segments.


🐂🐻 Bull/Bear Signal System

The Bull/Bear Signal System adds directional visual cues to highlight local momentum shifts and model-based trend confirmation.
  • Bull (🐂) — appears when upward momentum is confirmed (momentum > 0).
    Displayed below the bar, colored with Bullish Color.
  • Bear (🐻) — appears when downward momentum is dominant (momentum < 0).
    Displayed above the bar, colored with Bearish Color.

Signals are generated during model recalculations or when the directional bias changes in Continuous mode.
These visual markers are analytical aids, not trading triggers.

🧠 Core Algorithmic Components
  1. Regularized AutoRegression (Ridge AR):
    Solves: (X′X+λI)−1X′y
    to derive stable regression coefficients.
  2. Matrix and Pseudoinverse Operations — implemented natively in Pine Script™.
  3. Prefiltering (EMA / Ehlers SuperSmoother) — stabilizes noisy data.
  4. Forecast Dynamics — integrates damping, momentum, and mean reversion.
  5. Trend Visualization — color-coded bullish/bearish line segments.
  6. Bull/Bear Signal Engine — visualizes real-time impulse direction.


📊 Applications
  • Academic and educational purposes;
  • Demonstration of Ridge Regression and AR models;
  • Analysis of bull/bear market phase transitions;
  • Visualization of time-series dependencies.


⚠️ Disclaimer
This script is provided for educational and research purposes only.
It does not provide trading or investment advice.
The author assumes no liability for financial losses resulting from its use.
Use responsibly and at your own risk.
เอกสารเผยแพร่
Minor Updates

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ ข้อกำหนดการใช้งาน