TradingView
chanu_lev10k
29 Nov 2021 pukul 17.44

Linear Regression Channel Breakout Strategy 

Deskripsi

This strategy is based on LonesomeTheBlue's Linear Regression Channel Indicator. First of all, I would like to thank LonesomeTheBlue. Breaking the Linear Regression Channel to close the candle triggers a Long or Short signal. If the slope of the Linear Regression Channel is positive, it is Short when it breaks out the lower line, and when the slope is negative, it is Long when it breaks out the upper line. The default is optimized for 8-hour candles, and for other hour candles, find the optimal value yourself. Below is a description of LonesomeTheBlue's Linear Regression Channel.
이 전략은 LonesomeTheBlue의 Linear Regression Channel Indicator를 기반으로 만들어졌습니다. 우선 LonesomeTheBlue님께 감사의 말씀을 드립니다. Linear Regression Channel을 돌파하여 봉 마감하면 Long 또는 Short 신호를 트리거합니다. Linear Regression Channel의 기울기가 양인 경우 하단 라인을 돌파하면 Short이고 그 기울기가 음인 경우 상단 라인을 돌파하면 Long입니다. 기본값은 8시간봉에 최적화 되어 있으며, 다른 시간봉은 직접 최적값을 찾아보십시오. 아래는 LonesomeTheBlue의 Linear Regression Channel에 대한 설명을 퍼왔습니다.
________________________________________________
There are several nice Linear Regression Channel scripts in the Public Library. and I tried to make one with some extra features too. This one can check if the Price breaks the channel and it shows where is was broken. Also it checks the momentum of the channel and shows it's increasing/decreasing/equal in a label, shape of the label also changes. The line colors change according to direction.

using the options, you can;
- Set the Source (Close, HL2 etc)
- Set the Channel length
- Set Deviation
- Change Up/Down Line colors
- Show/hide broken channels
- Change line width

meaning of arrows:
⇑ : Uptrend and moment incresing
⇗ : Uptrend and moment decreasing
⇓ : Downtrend and moment incresing
⇘ : Downtrend and moment decreasing
⇒ : No trend

Catatan Rilis

[Important changes]
In the previous version of the long and short conditions, the following second case was added to maximize the profit. The default values have also been changed accordingly.

Long condition
1. Slope < 0, break the upper line (original v1)
or
2. Slope > 0, break the top line (added in v2)

Short condition
1. Slope > 0, break the bottom line (original v1)
or
2. Slope < 0, break the bottom line (added in v2)
Komentar
MargD
Terrific, thanks so much for sharing x
chanu_lev10k
@MargD, You're welcome:)
ricfil
Hi @chanu_lev10k
First of all, great work.
Do you know if repaints?
And would be possible to add alerts to the script, when triggers the blue and red arrows (long and short)?
Thank you
chanu_lev10k
@ricfil, Thank you for your comments. I think this strategy doesn't repaint. It is possible to add alerts to the script when triggers the blue and red arrows if you add both long and short conditions as shown below. I also added this condition with the same thoughts as you, but as a result of backtesting, it was not reflected because the profit was not good. If you need it, you can modify it and use it.

longCondition = slope > 0 and slope > slope(1)
shortCondition = slope < 0 and slope < slope(1)

* ( ) must be replaced with square brackets.
ricfil
Hi @chanu_lev10k, Thank you for the reply.

Unfortunately I don't know how to program.
Should I just add this codes in the end of the source code or on a particular code line?
About using this alerts, what do you mean that didn't reflect a good backtest? Just because of alerts? There's different positions entrance when triggers the alert?
Thank you again. God bless you.
chanu_lev10k
@ricfil, You just need to edit code lines 74 and 77.
93cdb00abb554654b780e737d8b809
so wrong strategy
chanu_lev10k
@93cdb00abb554654b780e737d8b809, In what ways is the strategy wrong?
Jaguar_Baby
@93cdb00abb554654b780e737d8b809, yes i agree with you. Seem like this Linear regression strategy facing offset problem, setting the same parameter but not tally with other linear regression channel.
Lebih lanjut