OPEN-SOURCE SCRIPT

Linear Regression Trendline on Close

235

This indicator draws a linear regression trendline that connects the closing prices of the last N candles, where N is a user-defined input.

🔹 Key Features:

Uses least-squares linear regression to fit a straight line to recent closes

Automatically adapts to any timeframe (5min, 1h, daily, etc.)

Input lets you select how many recent candles to include

Helps identify short-term trend direction and momentum

🔸 How to Use:

Set the "Number of Candles" input to choose how far back the regression line should look

The line updates in real time as new candles form

Use it to gauge short-term bias, or combine with support/resistance/zones for confirmation

🧠 Tip: Increase the number of candles for smoother trends; decrease for more reactive trendlines.

免責聲明

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