TradingView
okhanLAB
Feb 3, 2022 1:46 PM

Linear Regression Channel - Auto Volume Based 

Bitcoin / TetherUS PERPETUAL CONTRACTBinance

Description

Based on oryginal TV indicator BUT with a little twist. ;)

I really like the regression channel - but the problem is that the length needs to be always manually adjusted.
In this script I try to solve this issue.

This is modified version on TV indicator - Linear Regression Channel.

The main difference is that now you don't get static length - it is automatically adjuested to the recent price action (determined by highest volume in last 300 bars).
Comments
gtfalmi
Is it possible to get some kind of alarm when lower line2 is broken?
ctgaff
I am not sure many people realize the amount of manual intervention the built-in LinReg requires to be accurate. I manually adjusted 20 pairs tonight then went back after finding this indicator to compare. I only had to reduce the max and then it literally matched my adjustments on 19 of 20 pairs automatically!
Blue_Eyed_Owl
@ctgaff, this sold it to me
JMF_Tattoo
How is it volume based if were not actually weighting the volume somehow in the linear regression formula? Reading through the code it looks like your just asking to launch from the last highest volume bar within the length parameters. So its more of a Volume event launching channel, but not actually volume weighted?
okhanLAB
@ferreirajames, I never said it's volume weighted, but this is interesting idea. ;)
And yes, you are right - the script is looking for the best place to start the channel within provided max and min len.
I'm working on some improvements for this script - I'm going to use two methods: biggest volume and trend change (calculated by supertrend). Then I'll compare pearon's R for both and pick the one with highest Pearson R score.
If you have other ideas feel free to share!
Thanks for the comments.
JMF_Tattoo
@okhanLAB, Yeah thats an awesome idea, I have one i have been working on that folds the volume into calc, and hunts for highest volume as well. Also a 4 dev point and click one i have been using that i really enjoy.
joyfulPie86916
Hi, I see a small calculation problem, when I select Max 34 and Min 21, ( same as Max 233 and Min 144 ) they calculate with 33 and 232 days but 34 and 233 Pearson's R values are better. ( They select 1 day less )
happyIguana21867
Great script!
HemrajIngale
Thanks.
Can we have "Values on Status Line" option in display setting
More