OPEN-SOURCE SCRIPT

Segment Regression

262
As an example of the descriptive power of Pine Script, this very short example traces a 'segment regression', a result not entirely obvious with so few lines of code, repositioning them when the previous inference moves away from the graph beyond the pre-set limit.

A trick used is to restart the new inference segment
- from the maximum reached in the previous trend, when positive (slope>0)
- from the minimum reached in the previous trend, when negative (slope<0)

The result can in my opinion be easily used to build strategies.

免責聲明

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