Moving Polynomial Regression
- Indicatori
- Loemiro Boholts Busis
- Versione: 1.1
Moving Polynomial Regression 📈
The Moving Polynomial Regression indicator provides traders with a statistically robust and adaptive method for identifying the true trend, predicting immediate momentum shifts, and filtering market noise. Unlike traditional moving averages that simply lag the price, this tool fits an optimal polynomial curve to the market, giving you a dynamic and predictive view of price action.
Key Advantages
-
Superior Noise Filtering: Uses advanced mathematical techniques (QR Decomposition and Least Squares) to fit a smooth, higher-degree curve to the data, effectively filtering out minor market fluctuations and focusing on the underlying trend. * Predictive Momentum Signal: The core algorithm calculates the predicted next-step value of the curve. This instantly signals a shift in market momentum by changing the indicator's color, giving you an early warning for potential reversals or the continuation of a strong move.
-
Dynamic Support & Resistance: The regression line acts as a highly adaptive equilibrium point. Price pulling back to the line and bouncing confirms trend strength, while a definitive break of the line signals a major structural change in the market.
-
Optimized Performance: The heavy matrix calculations required for regression analysis are pre-computed in the initialization stage, ensuring the indicator runs with zero lag, even when analyzing large amounts of historical data.
Features & Settings
The indicator is designed for versatility and runs directly on the main chart window.
Parameter | Type | Default Value | Description |
| Source | ENUM_APPLIED_PRICE | PRICE_CLOSE | The price type used for the regression calculation (Close, Median, Typical, etc.). |
| Local Polynomial Degree | int | 2 (or 3) | Defines the curvature of the fit. Degree 1 is a simple linear channel; Degree 2 (parabolic) and 3 (cubic) allow the line to adapt dynamically to accelerating/decelerating trends. |
| Length | int | 18 | The size of the sample window (in bars) used to calculate the regression curve. Shorter lengths are more sensitive; longer lengths are smoother. |
| Predict Trend Direction | bool | true | When true, the indicator line will change color based on the predicted slope of the polynomial curve (Green for predicted up, Red for predicted down). |
Trend Signal Logic
The indicator uses a multi-color line to clearly visualize the trend and momentum:
-
🟢 Green: Predicted upward momentum (Next step $Y_f >$ Current step $Y$). Use this to confirm BUY entries.
-
🔴 Red: Predicted downward momentum (Next step $Y_f <$ Current step $Y$). Use this to confirm SELL entries or take profits.
-
Blue (Default): Neutral or flat momentum.
