OPEN-SOURCE SCRIPT

Linear Regression Trendline on Close

686

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.

Thông báo miễn trừ trách nhiệm

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.