germanburrito
Active member
I really like this indicator, here is another fun take on it, this is the wavetrend indicator with a donchian, donchian channels are usually calculated over 21 periods however I notice that a 34 period could give you better "safer" signals, although 21 period works just fine, I use it to confirm a continuation of direction.
Code:
#WT_LB Short Name TV
declare lower;
input Channel_Length = 10; #10
input Average_Length = 21; #10
input over_bought_1 = 60;
input over_bought_2 = 53;
input over_sold_1 = -60;
input over_sold_2 = -53;
input show_bubbles = yes;
input show_sec_bbls = no;
input show_alerts = yes;
def ap = hlc3;
def esa = ExpAverage(ap, Channel_Length);
def d = ExpAverage(AbsValue(ap - esa), Channel_Length);
def ci = (ap - esa) / (0.015 * d);
def tci = ExpAverage(ci, Average_Length);
def wt1 = tci;
def wt2 = SimpleMovingAvg(wt1, 4);
def zero = 0;
plot obLevel1 = over_bought_1;
obLevel1.SetDefaultColor(Color.RED);
plot osLevel1 = over_sold_1;
osLevel1.SetDefaultColor(Color.GREEN);
plot obLevel2 = over_bought_2;
obLevel2.SetDefaultColor(Color.RED);
obLevel2.SetStyle(Curve.SHORT_DASH);
plot osLevel2 = over_sold_2;
osLevel2.SetDefaultColor(Color.GREEN);
osLevel2.SetStyle(Curve.SHORT_DASH);
plot wt1_1 = wt1;
wt1_1.SetDefaultColor(Color.GREEN);
plot wt2_1 = wt2;
wt2_1.SetDefaultColor(Color.RED);
wt2_1.SetStyle(Curve.POINTS);
def signal1 = wt1 crosses above wt2 and wt1 < over_sold_2;
plot Signal = if signal1 then (signal1 * over_sold_2) else Double.NaN;
Signal.SetDefaultColor(Color.GREEN);
Signal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
Signal.SetLineWeight(3);
Signal.HideTitle();
def signal2 = wt1 crosses below wt2 and wt1 > over_bought_2;
plot Signal2_ = if signal2 then (signal2 * over_bought_2) else Double.NaN;
Signal2_.SetDefaultColor(Color.RED);
Signal2_.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
Signal2_.SetLineWeight(3);
Signal2_.HideTitle();
#Name: DonchianChannel
#Programmed By: Chris Ball ([email protected]) on 10/23/08
#Posted At: http://chartingwithchris.blogspot.com
#Description: This is a channel system that is used frequently for trend trading. Google the term "turtle trader" for more information.
#Modified 2020-06-10 by rad14733 to utilize AddCloud()
input length_donchian = 34;
plot upperBand = Highest(wt1_1[1], length_donchian);
plot lowerBand = Lowest(wt1_1[1], length_donchian);
plot middleBand = (upperBand + lowerBand) / 2;
upperBand.SetDefaultColor(Color.DARK_GRAY);
lowerBand.SetDefaultColor(Color.DARK_GRAY);
middleBand.SetDefaultColor(Color.Orange);
AddCloud(upperBand, lowerBand, Color.DARK_GRAY, Color.WHITE);