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提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?