Boom Hunter Pro For ThinkOrSwim

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

THIS IS NOT AN EXACT CONVERSION

@airgb @petergluis

AFAIK this isn't possible to fully convert because the RSI used in the original script requires a dynamic length which is not easily done/if possible at all for ToS. Didn't convert the repainting parts of the indicator as well. Used arrows instead of the multicolored long labels. I won't be updating this since I don't plan on using this. I would stick to TV for this if you're serious about this indicator.

Code:
declare lower ;
input showentry = yes;
input square = yes;
input showdboom = yes;
input showlongs = yes;
input showshorts = yes;

input LPPeriod = 6;
input K1 = 0;
def K2 = 0.3;
def esize = 60;
def ey = 50;
input trigno = 2;

input LPPeriod2 = 27;
input K12 = 0.8;
input K22 = 0.3;
def esize3 = 60;
def ey3 = 50;

input LPPeriod3 = 11;
input K13 = 0.9999;
def K33 = K13 * -1;
def esize2 = 60;
def ey2 = 50;

input n1 = 9;
input n2 = 6;
input n3 = 3;
input n4 = 21;
input n5 = 0;
def smalen = 2;
input lsmaline = 200;

def alpha1 = (Cos(.707 * 2 * Double.Pi / 100) + Sin(.707 * 2 * Double.Pi / 100) - 1) / Cos(.707 * 2 * Double.Pi / 100);
def HP = (1 - alpha1 / 2) * (1 - alpha1 / 2) * (close - 2 * close[1] + close[2]) + 2 * (1 - alpha1) * HP[1] - (1 - alpha1) * (1 - alpha1) * HP[2];

def a1 = Exp(-1.414 * Double.Pi / LPPeriod);
def b1 = 2 * a1 * Cos(1.414 * Double.Pi / LPPeriod);
def c2 = b1;
def c3 = -a1 * a1;
def c1 = 1 - c2 - c3;
def Filt = c1 * (HP + HP[1]) / 2 + c2 * Filt[1] + c3 * Filt[2];

def Peak = if AbsValue(Filt) > Peak[1] then AbsValue(Filt) else .991 * Peak[1];

def X = if Peak != 0 then Filt / Peak else X[1];

def Quotient1 = (X + K1) / (K1 * X + 1);
def Quotient2 = (X + K2) / (K2 * X + 1);

def alpha1222 = (Cos(.707 * 2 * Double.Pi / 100 ) + Sin( .707 * 2 * Double.Pi / 100 ) - 1 ) / Cos( .707 * 2 * Double.Pi / 100 );
def HP2 = ( 1 - alpha1222 / 2 ) * ( 1 - alpha1222 / 2 ) * ( close - 2 * close[1] + close[2] ) + 2 * ( 1 - alpha1222 ) * HP2[1]  - ( 1 - alpha1222 ) * ( 1 - alpha1222 ) * HP2[2];

def a12 = Exp(-1.414 * Double.Pi / LPPeriod2);
def b12 = 2 * a12 * Cos( 1.414 * Double.Pi / LPPeriod2 );
def c22 = b12;
def c32 = -a12 * a12;
def c12 = 1 - c22 - c32;
def Filt2 = c12 * ( HP2 + HP2[1] ) / 2 + c22 * Filt2[1] + c32 * Filt2[2];

def Peak2 = if AbsValue(Filt2) > Peak2[1] then AbsValue(Filt2) else .991 * Peak2[1];

def X2 = if Peak2 != 0 then Filt2 / Peak2 else X2[1];

def Quotient3 = (X2 + K12) / (K12 * X2 + 1);
def Quotient4 = (X2 + K22) / (K22 * X2 + 1);

def alpha1333 = ( Cos( .707 * 2 * Double.Pi / 100 ) + Sin( .707 * 2 * Double.Pi / 100 ) - 1 ) / Cos( .707 * 2 * Double.Pi / 100 );
def HP3 = ( 1 - alpha1333 / 3 ) * ( 1 - alpha1333 / 2 ) * ( close - 2 * close[1] + close[2] ) + 2 * ( 1 - alpha1333 ) * HP3[1]  - ( 1 - alpha1333 ) * ( 1 - alpha1333 ) * HP3[2];

def a13 = Exp( -1.414 * Double.Pi / LPPeriod3 );
def b13 = 2 * a13 * Cos( 1.414 * Double.Pi / LPPeriod3 );
def c33 = b13;
def c333 = -a13 * a13;
def c13 = 1 - c33 - c333;
def Filt3 = c13 * ( HP3 + HP3[1] ) / 2 + c33 * Filt3[1] + c333 * Filt3[2];

def Peak3 = if AbsValue(Filt3) > Peak3[1] then AbsValue(Filt3) else .991 * Peak3[1];
def X3 = if Peak3 != 0 then Filt3 / Peak3 else X3[1];

def Quotient5 = (X3 + K13) / (K13 * X3 + 1);
def Quotient6 = (X3 + K33) / (K33 * X3 + 1);

def line1 = -0.9;

def src0 = open;
def src1 = high;
def src2 = low;
def src3 = close;
def src4 = hl2;
def src5 = hlc3;
def src6 = ohlc4;
def src7 = TrueRange(high, close, low);
def vol  = volume;

script tci {
    input src = 0;
    input n1 = 9;
    input n2 = 6;

    plot return = ExpAverage((src - ExpAverage(src, n1)) / (0.025 * ExpAverage(AbsValue(src - ExpAverage(src, n1)), n1)), n2) + 50;
}

script tradition {
    input src = 0;
    input n3 = 3;
    plot return = (tci(src)+rsi(length = n3,price = src))/2;
}

def wt1 = tradition(src5);
def wt2 = SimpleMovingAvg(wt1,6);

def wt3 = linearRegCurve(n5,n4,wt1);
def wt4 = ExpAverage((wt1-wt2)*2+50,n3);
def trig = SimpleMovingAvg(wt3,smalen);

plot q3 = quotient3*esize+ey;
plot q4 = quotient4*esize+ey;
q3.SetDefaultColor(color.dark_red);
q4.SetDefaultColor(color.dark_red);
addcloud(q3,q4,color.dark_red,color.dark_red);

def q1 = Quotient1 * esize + ey;
def q2 = Quotient2 * esize + ey;
def trigger = simpleMovingAvg(q1, trigno);

def ext1 = if wt2 < 20 then trigger+9 else if wt2 > 80 then trigger-9 else Double.Nan;

def lsma = linearRegCurve(0,lsmaline,wt3);

plot q5 = Quotient5 * esize2 + ey2;
plot q6 = Quotient6 * esize2 + ey2;

def sma200 = simpleMovingAvg(close, 200);
def entry = quotient2 crosses below line1;
def exit = quotient1 crosses quotient2 and close > sma200 and quotient1 > 0.5;
def over = quotient5 crosses quotient6 and quotient5 > 0.5;
def over2 = quotient5 crosses above quotient6 and quotient5 >.5;
def over3 = quotient3 crosses quotient4 and quotient3 >0;
def enter = q1 crosses above trigger and q1 < lsma;

plot exitw = if showentry then if over or over3 then 0 else double.nan else double.nan;
exitw.SetPaintingStrategy(PaintingStrategy.POINTS);
exitw.AssignValueColor(if over then color.orange else color.red);

plot plot1 = q1;
plot plot3 = trigger;
plot plote = ext1;
plot1.setdefaultColor(color.cyan);
plot3.setDefaultColor(color.white);
plote.assignValueColor(if wt2<20 then color.green else if wt2>80 then color.red else color.current);
plote.setPaintingStrategy(PaintingStrategy.POINTS);

def warn = quotient3 crosses above -0.9;
def warn2 = quotient1 crosses above -0.9;
def warn3 = quotient1 crosses below 0.9;
def barx = barnumber();
def bar2 = if warn2 then barx else bar2[1];
def bar3 = if warn3 then barx else bar3[1];
def bare3 = if q1 crosses above 20 then barx else bare3[1];
def bare5 = if q1<=0 and q1 crosses below trigger then barx else bare5[1];
def bare6 = if q1<=20 and q1 crosses below trigger then barx else bare6[1];
def barse3 = if q1 crosses above 80 then barx else barse3[1];
def enter3 = quotient3 <= -0.9 and q1 crosses above trigger and barx-bar2 <=7 and q1 <=20 and barx-bare3 <=21;
def enter5 = barx-bare5 <= 5 and q1 crosses above trigger;
def enter6 = barx-bare6 <=11 and q1 crosses above trigger;
def enter7 = quotient3 <=-0.9 and q1 crosses above trigger;
def senter3 = quotient3 >= -0.9 and q1 crosses below trigger and barx-bar3 <=7 and q1 >=99 and barx-barse3<=21;

plot longgray = if showlongs and enter6 and q1 <= 60 then 100 else double.nan;
plot longyellow = if showlongs and enter7 then 100 else double.nan;
plot longblue = if showlongs and enter5 then 100 else double.nan;
plot longlime = if showlongs and enter3 then 100 else double.nan;
plot short = if showshorts and senter3 then 100 else double.nan;

longgray.setPaintingStrategy(paintingStrategy.ARROW_UP);
longyellow.setPaintingStrategy(paintingStrategy.ARROW_UP);
longblue.setPaintingStrategy(paintingStrategy.ARROW_UP);
longlime.setPaintingStrategy(paintingStrategy.ARROW_UP);
short.setPaintingStrategy(paintingStrategy.ARROW_DOWN);

longgray.setDefaultColor(color.light_gray);
longyellow.setDefaultColor(color.yellow);
longblue.setDefaultColor(color.blue);
longlime.setDefaultColor(color.lime);
short.setDefaultColor(color.red);
addchartbubble(over3,0,"Overbought");
 
Last edited by a moderator:
THIS IS NOT AN EXACT CONVERSION

@airgb @petergluis

AFAIK this isn't possible to fully convert because the RSI used in the original script requires a dynamic length which is not easily done/if possible at all for ToS. Didn't convert the repainting parts of the indicator as well. Used arrows instead of the multicolored long labels. I won't be updating this since I don't plan on using this. I would stick to TV for this if you're serious about this indicator.
Thank you very much for your help.

It has achieved more than 90% features of one in Tradingview. It is very nice since you have kept most of its features. The indicator shows inconsistence between QQQ and /NQ (E-mini Nasdaq 100 index Futures). Buy signal of QQQ around 9/27/2021 disappears compared with that of /NQ.

I tested SPY, DIA, IWM, and found out that some parts of your indicator match those of counterpart in Tradingview in some specific times, and some parts are significantly different in other times.
 
Last edited by a moderator:
This indicator has had some interesting results for me on the /ES. I was curious, there's a notification of "over bought", is there supposed to be one for "over sold" as well? Thank you for converting it over to ToS!
 
as you can see sometimes appear overshoots/glitches in both directions. is it possible to correct it?

glithces in boom hunter pro.jpg
 
Last edited by a moderator:
as you can see sometimes appear overshoots/glitches in both directions. is it possible to correct it?

View attachment 19433
I substituted q5 and q6 to avoid those visual glitches with:

plot q5 = if (Quotient5 * esize2 + ey2) > 110 then 110 else if (Quotient5 * esize2 + ey2) < -10 then -10 else (Quotient5 * esize2 + ey2);

plot q6 = if (Quotient6 * esize2 + ey2) > 110 then 110 else if (Quotient6 * esize2 + ey2) < -10 then -10 else (Quotient6 * esize2 + ey2);
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
330 Online
Create Post

Similar threads

Similar threads

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