LuxAlgo

Machine Learning: Anchored Gaussian Process Regression [LuxAlgo]

Machine Learning: Anchored Gaussian Process Regression is an anchored version of Machine Learning: Gaussian Process Regression.

It implements Gaussian Process Regression (GPR), a popular machine-learning method capable of estimating underlying trends in prices as well as forecasting them. Users can set a Training Window by choosing 2 points. GPR will be calculated for the data between these 2 points.

Do remember that forecasting trends in the market is challenging, do not use this tool as a standalone for your trading decisions.

🔶 USAGE

When adding the indicator to the chart, users will be prompted to select a starting and ending point for the calculations, click on your chart to select those points.


Start & end point are named 'Anchor 1' & 'Anchor 2', the Training Window is located between these 2 points. Once both points are positioned, the Training Window is set, whereafter the Gaussian Process Regression (GPR) is calculated using data between both Anchors.

The blue line is the GPR fit, the red line is the GPR prediction, derived from data between the Training Window.

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.


One of the advantages of the anchoring process is the ability for the user to evaluate the accuracy of forecasts and further understand how settings affect their accuracy.

The publication also shows the mean average (faint silver line), which indicates the average of the prices within the calculation window (between the anchors). This can be used as a reference point for the forecast, seeing how it deviates from the training window average.

🔶 DETAILS

🔹 Limited Training Window

The Training Window is limited due to matrix.new() limitations in size.


When the 2 points are too far from each other (as in the latter example), the line will end at the maximum limit, without giving a size error.


The red forecasted line is always given priority.

🔹 Positioning Anchors

Typically Anchor 1 is located further in history than Anchor 2, however, placing Anchor 2 before Anchor 1 is perfectly possibly, and won't give issues.

🔶 SETTINGS

  • Anchor 1 / Anchor 2: both points will form the Training Window.
  • 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.

Get access to our exclusive tools: luxalgo.com

Join our 150k+ community: discord.gg/lux

All content provided by LuxAlgo is for informational & educational purposes only. Past performance does not guarantee future results.
開源腳本

本著真正的TradingView精神,該腳本的作者將其開源發布,以便交易者可以理解和驗證它。為作者喝彩吧!您可以免費使用它,但在出版物中重複使用此代碼受網站規則的約束。 您可以收藏它以在圖表上使用。

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。

想在圖表上使用此腳本?