Waddah Attar Explosion in watchlist


Category:
0
0

Hello Pete,

I use a lower study called the Waddah study.  Would it be possibe to have a watch list column for this study.  I would like the WL column to be green if the bar is above both lines on chart and red if below.

 

declare lower;

#————- “Waddah Attar Explosion ” ————#

input sensitivity = 150; #”Sensitivity”
input fastLength = 20; #”FastEMA Length”
input slowLength = 40; #”SlowEMA Length”
input channelLength = 20; #”BB Channel Length”
input mult = 2.0; #”BB Stdev Multiplier”
input deadZone = 20; #”No trade zone threshold”

script calc_macd{

input source = close;
input fastLength = 20;
input slowLength = 40;

def fastMA = movAvgExponential(source, fastLength);
def slowMA = movAvgExponential(source, slowLength);

plot out = fastMA – slowMA;

}

script calc_BBUpper{

input source = close;
input length = 20;
input mult = 2.0;

def basis = simpleMovingAvg(source, length);
def dev = mult * stdev(source, length);

plot out = basis + dev;

}

script calc_BBLower{

input source = close;
input length = 20;
input mult = 2.0;

def basis = simpleMovingAvg(source, length);
def dev = mult * stdev(source, length);

plot out = basis – dev;

}

def t1 = (calc_macd(close, fastLength, slowLength) – calc_macd(close[1],
fastLength, slowLength)) * sensitivity;

def t2 = (calc_macd(close[2], fastLength, slowLength) –
calc_macd(close[3], fastLength, slowLength)) * sensitivity;

def e1 = (calc_BBUpper(close, channelLength, mult) – calc_BBLower(close,
channelLength, mult));

#//
def e2 = (calc_BBUpper(close[1], channelLength, mult) – calc_BBLower(close[1], channelLength, mult));

def trendUp = if t1 >= 0 then t1 else 0;
def trendDown = if t1 < 0 then (-1 * t1) else 0;

plot tUp = trendUp; #”UpTrend”
#Also try using columns to see how it looks.
tUp.setpaintingStrategy(paintingStrategy.HISTOGRAM);
tUp.assignValueColor(if trendUp < trendUp[1] then color.light_GREEN else
color.green);

plot tDn = trendDown; #”DownTrend”
tDn.setpaintingStrategy(paintingStrategy.HISTOGRAM);
tDn.assignValueColor(if trendDown < trendDown[1] then color.orange else
color.red);

plot ex = e1; #”ExplosionLine”
ex.setdefaultColor(createColor(160, 82, 45));

plot xLine = deadZone; #”DeadZoneLine”
xLine.setdefaultColor(color.blue);

#————- “Waddah Attar Explosion ” ————#

Marked as spam
Posted by (Questions: 49, Answers: 42)
Asked on August 15, 2019 5:51 pm
536 views
0
The histogram of this indicator consists of two plots. So when you say: "...green if the bar is above both lines on chart and red if below." Which of the two plots are you referring to? One is for uptrend and is named "tUp" and the other is for downtrend and is named "tDn". So you can't simply say "if the bar is above both lines". You need to explain which of these two plots you want the watchlist to pick up. It is quite clear from this code that when "tDn" plot is above those two lines the trend is down. And when the "tUp" plot is above those two lines the trend is up.
( at August 16, 2019 2:46 pm)