TradingView
konidtaly88
May 21, 2021 8:38 PM

Realtime Optimized Linear Regression Channel 

Micro E-mini S&P 500 Index FuturesCME

Description

this script is based on "Optimized Linear Regression Channel" by alexgrover, whose page I recommend you to visit, to read the extensive description he provides tradingview.com/script/tCREqC5O-Optimized-Linear-Regression-Channel/

the main difference with the original version is the fact that the start point of the channel (left point) is fixed by setting the time (Begin time input).
This way, the channel size is automatically set, meaning that the channel grows larger as new data comes in, while the starting point remains at the same spot

this can be useful to track a new trend that may be forming from an inflection point or pivot, by selecting begin time as the time of the inflection

also, an end date input is provided to limit the size of the channel.

The script provides two channels:
  • the main channel that contain all data from begin to end time
  • the best fit channel that finds the best linear fit inside data from begin to end time


one issue that the script has is the limit in the number of points of size of the channel, that if too large then make the channel disappear (sigh)

Release Notes

  • Added the possibility to choose which channel to show (or both)
  • Added the possibility to choose color and style for lines of the channels

Release Notes

Converted to pinescript v5 ...

Release Notes

  • solved the issue of the limit in bars back
  • now by default the beginning of the channel is set to today's first bar, see the new input tick
Comments
RozaniGhani-RG
thank you. very nice.
Kerasi
Excellent tool, but I'm getting an error, ((Pine cannot determine the referencing length of a series. Try using max_bars_back in the study))
DaytraderJM
@Kerasi, I'm getting same error, did you figure a way around it?
konidtaly88
@Kerasi @DaytraderJM check new version, it solves the issue!
Kerasi
@konidtaly88, great, thank you
More