TradingView
LuxAlgo
10 ืื•ืงืณ 2023 15:13

Machine Learning: Gaussian Process Regression [LuxAlgo]ย 

S&P 500SP

ืชื™ืื•ืจ

โ‹…
We provide an implementation of the Gaussian Process Regression (GPR), a popular machine-learning method capable of estimating underlying trends in prices as well as forecasting them.

While this implementation is adapted to real-time usage, do remember that forecasting trends in the market is challenging, do not use this tool as a standalone for your trading decisions.

๐Ÿ”ถ USAGE



The main goal of our implementation of GPR is to forecast trends. The method is applied to a subset of the most recent prices, with the Training Window determining the size of this subset.



Two user settings controlling the trend estimate are available, Smooth and Sigma. Smooth determines the smoothness of our estimate, with higher values returning smoother results suitable for longer-term trend estimates.



Sigma controls the amplitude of the forecast, with values closer to 0 returning results with a higher amplitude. Do note that due to the calculation of the method, lower values of sigma can return errors with higher values of the training window.

๐Ÿ”นUpdating Mechanisms

The script includes three methods to update a forecast. By default a forecast will not update for new bars (Lock Forecast).

The forecast can be re-estimated once the price reaches the end of the forecasting window when using the "Update Once Reached" method.

Finally "Continuously Update" will update the whole forecast on any new bar.

๐Ÿ”นEstimating Trends



Gaussian Process Regression can be used to estimate past underlying local trends in the price, allowing for a noise-free interpretation of trends.

This can be useful for performing descriptive analysis, such as highlighting patterns more easily.

๐Ÿ”ถ SETTINGS

  • Training Window: Number of most recent price observations used to fit the model
  • Forecasting Length: Forecasting horizon, determines how many bars in the future are forecasted.
  • Smooth: Controls the degree of smoothness of the model fit.
  • Sigma: Noise variance. Controls the amplitude of the forecast, lower values will make it more sensitive to outliers.
  • Update: Determines when the forecast is updated, by default the forecast is not updated for new bars.

ื”ืขืจื•ืช ืฉื—ืจื•ืจ

โ‹…
- Allows for greater training window
- Reduced matrix instability
ืชื’ื•ื‘ื•ืช
omar1981biz
โ‹…
Any opinions yet on its accuracy using different timeframes?

My assumption this will be more accurate currently on shorter timeframes 1hr or less. Any thoughts
blendedplanet
โ‹…
@omar1981biz, I have tested the hell out of this and honestly it could hardly be more useless. Long time frame, short, lots of smoothing, little smoothing, does not matter. Like most lagging indicators when it turns out to be spectacularly wrong - which it pretty much always does - it just changes it's mind. My driver here is comparing my own judgment to its recommendations. This would be more useful if you could simply tell it when to start its analysis - in other words if it uses 100 periods, don't neccesarily use the most *recent* 100 periods. If I have time I may mod the code in this way to see what gets plotted, but I already know what I would find is - bearing in mind the entire point is to proving *some* predictive value - it's simply no help at all b/c it is so often wrong. And to be clear, if you try to chase price on the premise that if it gives you at least a few candles of accuracy, you get the same ol' problem that it's always either wrong or just a little bit too late because by the time your path is clear price has already moved too much relative to the recommendations.
Triangle231
โ‹…
@blendedplanet, testing at moment on 3 minute heikin ashi will let know my thoughts.. seems to predict a turn coming on a volatile index not to bad for now..10 trades in
kakola
โ‹…
Someone backtest this...
nguyenhieuclgt
โ‹…
@kakola, It's 'machine learning'... legit enough.
blendedplanet
โ‹…
@nguyenhieuclgt, see my response above and take for what its worth
nguyenhieuclgt
โ‹…
@blendedplanet, Sorry about that. I appreciate what youโ€™re sharing with the community.
blendedplanet
โ‹…
@nguyenhieuclgt, no worries, I def was hoping it worked better than it did ;)
emkadf
โ‹…
@kakola, its useless as all Luxalgo
murse_money
โ‹…
Can you explain the machine learning component and how tradingview is able to manage machine learning?
ืขื•ื“