Waddah Attar Explosion Indicator for ThinkorSwim

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

First post in these forums but have been visiting for some time now... Hoping to contribute when I can...

This issue is caused by the deadzone setting being set too high due to trade instrument pricing differences... When I use this script for day trading options I set the value to 0.2 instead of the default setting of 20... The only other changes I have made to the script posted above, so far, are the ex and xLine colors... Hope this helps someone...

I use a laundry list of indicators to validate or invalidate potential trades... Realistically, I could suffice with Renko Bars, RSI superimposed over the Renko Bars, Trend Reversal Indicator with Signals, and Waddah Attar Explosion...
HI @rad14733 , How do you get the lines on the upper chart? Thanks
 
Last edited by a moderator:
@BenTen Is there way to show the color of Waddah into the chart Candle bar. Ex: if it is Red Buy signal make the candle color Red, if it is Dead Zone make the candle color Hollow candle... so on
 
@BenTen Is there way to show the color of Waddah into the chart Candle bar. Ex: if it is Red Buy signal make the candle color Red, if it is Dead Zone make the candle color Hollow candle... so on
Code:
declare lower;
input APC = 0;
#------------- "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 " ------------#
 AssignPriceColor( if APC == 1 && trendUp < trendUp[1] then color.light_GREEN else if APC ==1  &&  trendUp > trendUp[1] then color.green else
if APC ==1 && trendDown < trendDown[1] then color.orange else if APC ==1 && trendDown > trendDown[1] then
color.red else Color.Current);

set the APC input to 1 to color the bars and 0 ide the colored bars
 
Last edited:
@BenTen Is there way to show the color of Waddah into the chart Candle bar. Ex: if it is Red Buy signal make the candle color Red, if it is Dead Zone make the candle color Hollow candle... so on

This code allows for painted price candles and/or painted arrows

Screen Shot 2024-02-13 at 11.15.59 AM.png
Screen Shot 2024-02-13 at 11.18.06 AM.png

Code:
#_______________________________________________________________________

declare upper;

input paintarrows = Yes;
input paintbar = Yes;

#------------- "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;

def 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);

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

def ex = e1; #"ExplosionLine"
#ex.setdefaultColor(createColor(160, 82, 45));

def xLine = deadZone; #"DeadZoneLine"
#xLine.setdefaultColor(color.blue);

#------------- "Waddah Attar Explosion " ------------#


AssignPriceColor(if (paintbar and trendDown < trendDown[1]) then Color.ORANGE else if (paintbar and trendDown > trendDown[1]) then Color.RED else if (paintbar and trendUp < trendUp[1]) then Color.LIGHT_GREEN else if (paintbar and trendUp > trendUp[1]) then Color.GREEN else Color.CURRENT);

plot arrows = (paintarrows and trendDown < trendDown[1]) or (paintarrows and trendUp < trendUp[1]);
arrows.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
arrows.AssignValueColor(if (paintarrows and trendDown < trendDown[1]) then Color.ORANGE else if (paintarrows and trendDown > trendDown[1]) then Color.RED else if (paintarrows and trendUp < trendUp[1]) then Color.LIGHT_GREEN else if (arrows and trendUp > trendUp[1]) then Color.GREEN else Color.CURRENT);
arrows.SetLineWeight(1);

Alert(tUp crosses above ex and ex > xLine, "tUp Alert", Alert.BAR, Sound.Ding);
Alert(tDn crosses above ex and ex > xLine, "tDn Alert", Alert.BAR, Sound.Ding);


#------------- "Waddah Attar Explosion " ------------#
 
@BenTen Is there way to show the color of Waddah into the chart Candle bar. Ex: if it is Red Buy signal make the candle color Red, if it is Dead Zone make the candle color Hollow candle... so on
Hi @sky4blue I noticed a small error in the code I posted. It was sometime coloring candles orange when they should be green. I have fixed this issue in the code below.


Code:
AssignPriceColor(if (paintbar and trendUp > trendUp[1]) then Color.GREEN else if (paintbar and trendDown > trendDown[1]) then Color.RED else if (paintbar and trendDown < trendDown[1]) then Color.ORANGE else if(paintbar and trendUp <= trendUp[1]) then Color.LIGHT_GREEN else Color.gray);

plot arrows = (paintarrows and trendDown < trendDown[1]) or (paintarrows and trendUp < trendUp[1]);
arrows.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
arrows.SetLineWeight(1);

arrows.AssignValueColor(if (paintarrows and trendUp > trendUp[1]) then Color.GREEN else if (paintarrows and trendDown > trendDown[1]) then Color.RED else if (paintarrows and trendDown < trendDown[1]) then Color.ORANGE else if(paintarrows and trendUp <= trendUp[1]) then Color.LIGHT_GREEN else Color.gray);


Alert(tUp crosses above ex and ex > xLine, "tUp Alert", Alert.BAR, Sound.Ding);
Alert(tDn crosses above ex and ex > xLine, "tDn Alert", Alert.BAR, Sound.Ding);
 
Is there anyway we can get the color to show up on mobile?
Here is the Waddah Attar Explosion Indicator converted by Syracusepro ThinkorSwim. I also found this indicator on MQL5 as well.

View attachment 4341

Some notes I found:



thinkScript Code

Rich (BB code):
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 " ------------#

Shareable Link

https://tos.mx/BM3O4c

Hey guys,

@MerryDay @samer800

Is there anyway we can get the color to show up on mobile?
 
Last edited by a moderator:

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
417 Online
Create Post

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top