OPEN-SOURCE SCRIPT

Linear Regression Trendline on Close

67

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.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.