Black Dog System Indicator for ThinkorSwim - Strategy

@Trading51 Good for you, when @tenacity11 first posted the BlackDog link, I noticed it has a RAR file extension and hence that was why I made that comment. Now you'll be able to look deeper into how the BlackDog study works. All the very best!
 
Singapore dude! I'm certainly not one of them, if not I won't be trading 😭 middle working class slogging away for my higher ups! oh i feel so lucky.


Okay I'll bear that in mind for the future. You're way too kind. Thinkscript is actually quite straightforward once you have gone through the tutorials and either studied or done lots of examples. Even an artist, a mechanic or a painter can pick it up quick easily. I spent a few years in the ThinkScript lounge, been "trained" by Mobius and other great contributors there. Anything you need, just tag me on a message and I'll do what I can to assist. Stay safe.
 
Okay I'll bear that in mind for the future. You're way too kind. Thinkscript is actually quite straightforward once you have gone through the tutorials and either studied or done lots of examples. Even an artist, a mechanic or a painter can pick it up quick easily. I spent a few years in the ThinkScript lounge, been "trained" by Mobius and other great contributors there. Anything you need, just tag me on a message and I'll do what I can to assist. Stay safe.

Thanks! I'm learning bit by bit, but as I trade, I realize no matter what variables you input in, it always "lags" in the sense that price, volume, or something else needs to move first before the indicator settles at candle close. Something is missing in my trading system, that can predict what's the future movement will be like, except fibo but that's a drawing tool. After watching and reading so much, I think I need to go back to basics, support resistance, and candlesticks.
 
Thanks! I'm learning bit by bit, but as I trade, I realize no matter what variables you input in, it always "lags" in the sense that price, volume, or something else needs to move first before the indicator settles at candle close. Something is missing in my trading system, that can predict what's the future movement will be like, except fibo but that's a drawing tool. After watching and reading so much, I think I need to go back to basics, support resistance, and candlesticks.


@Playstation It's pretty hard to predict future movement. However whatever you do, pay attention to market internals especially if you are a day trader. If you are not already familiar with this topic, have a look through the following link which may help somewhat.

https://usethinkscript.com/threads/three-different-adspd-adv-dec-codes-to-try-out.1328/#post-12579
Keep an eye out on the volatility futures in a backwardation state. In 2018 for instance the volatility futures were in a massive backwardation state for 16 weeks while in 2019, it only happened for 2 weeks. For 2020 - it's anyone's guess but I'm certainly keeping a watchful eye. You might also like to play with the following study, which I updated for a requestor about a month ago. Best of luck!

https://usethinkscript.com/threads/vx-futures-contango-indicator-for-thinkorswim.1177/#post-11256
 
@tomsk wow! Thank you! I do set up the market internals in a chart, with $tick $trin etc. but this the first time i come across an indicator on this. Gonna take me another 1-2 hours of reading but new knowledge is always good! You have 2 beers to your name now ha!
 
Black dog MTF ? have it set on the 20 minute and use a 5 minute time frame that would be a decent fit for this
 
Okay I'll bear that in mind for the future. You're way too kind. Thinkscript is actually quite straightforward once you have gone through the tutorials and either studied or done lots of examples. Even an artist, a mechanic or a painter can pick it up quick easily. I spent a few years in the ThinkScript lounge, been "trained" by Mobius and other great contributors there. Anything you need, just tag me on a message and I'll do what I can to assist. Stay safe.
Thanks you
 
I may need your help to explain a little on the top and bottom chart AD bubble.
On a /CL chart 5mins, the high is 231, low is 41 close 132 Avg -73. What does it mean? The rate of change?

@Playstation It's pretty hard to predict future movement. However whatever you do, pay attention to market internals especially if you are a day trader. If you are not already familiar with this topic, have a look through the following link which may help somewhat.

https://usethinkscript.com/threads/three-different-adspd-adv-dec-codes-to-try-out.1328/#post-12579
Keep an eye out on the volatility futures in a backwardation state. In 2018 for instance the volatility futures were in a massive backwardation state for 16 weeks while in 2019, it only happened for 2 weeks. For 2020 - it's anyone's guess but I'm certainly keeping a watchful eye. You might also like to play with the following study, which I updated for a requestor about a month ago. Best of luck!

https://usethinkscript.com/threads/vx-futures-contango-indicator-for-thinkorswim.1177/#post-11256
 
@Playstation Many studies have been posted, not sure which one you're referring to. Post the study and I'll do what I can to better explain to you
 
Today's question (ha ha)... What's the code to have a text box in the top left of the chart that shows the direction of the last BDog arrow? I've discovered AddLabel but am unable to get it to work correctly. As always, thank you.

@hashy I've got a basic addlabel on mine that shows the BDup or down in the corner. It only works if there's a BD within a few bars and then goes away after a while. Still learning thinkscript. I'll post when I get a chance
 
@hashy

Add this at the end of the code:

AddLabel(BD, concat("BD:", if UpCross then "UP" else if DnCross then "DOWN" else "NAN"), if UpCross then color.GREEN else if DnCross then color.RED else color.WHITE);
 
@BenTen Can you help when I add this to the study for an label (AddLabel(BD, concat("BD:", if UpCross then "UP" else if DnCross then "DOWN" else "NAN"), if UpCross then color.GREEN else if DnCross then color.RED else color.WHITE)
I get an error on addable BD
 
Last edited by a moderator:
Can anyone help when I add this to the study for an label I get an error (AddLabel(BD, concat("BD:", if UpCross then "UP" else if DnCross then "DOWN" else "NAN"), if UpCross then color.GREEN else if DnCross then color.RED else color.WHITE)
I get an error on addable BD
 
Today's question (ha ha)... What's the code to have a text box in the top left of the chart that shows the direction of the last BDog arrow? I've discovered AddLabel but am unable to get it to work correctly. As always, thank you.

Can anyone help when I add this to the study for an label I get an error (AddLabel(BD, concat("BD:", if UpCross then "UP" else if DnCross then "DOWN" else "NAN"), if UpCross then color.GREEN else if DnCross then color.RED else color.WHITE)
I get an error on addable BD

I've noticed several requests to add a chart label on Black Dogs & SESs 5 minute study that displays the direction of the last BDog cross arrow. I've implemented this based on the original code to that @BenTen posted in March 2019 when this thread first started (see post #1). I have it tested and looks good to go. Remember according to Ben's original note this study is designed to work on a 5 minute chart

Here then is version 1.1 of the Blackdog study. I have color coded the label for the last BDog UP/DOWN direction

Code:
#   Black Dogs & SESs---For 5 minute chart ONLY
#   NAMED BlackDog_SES_5min
#   Originally posted by BenTen
#   Modifications by tomsk, 1.10.2020

# V1.0 - 03.29.2019 - BenTen - Initial release of Black Dogs & SESs (5 Minute Aggregation) study
# V1.1 - 01.10.2020 - tomsk  - Added state transition engine and label that displays direction of last BDog signal

#   Here, "Black Dogs" are WHITE for use on a dark background.

input Hprice = high;
input Lprice = low;
input price = close;
input Hlength = 50;
input Llength = 50;
input Hdisplace = 0;
input Ldisplace = 0;

def StateUp = 1;
def StateDn = 2;

#   High / Low Band for SES computations---------------------------
#   EMA of HIGHS-----------------------------------------------------------
plot HAvg = MovAvgExponential(Hprice[-Hdisplace], Hlength);

HAvg.SetDefaultColor(Color.WHITE);
HAvg.SetLineWeight(5);
HAvg.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
HAvg.SetStyle(Curve.FIRM);
HAvg.HideBubble();
HAvg.HideTitle();

HAvg.AssignValueColor(if HAvg< HAvg[1] then Color.VIOLET else (if HAvg == HAvg[1] then Color.YELLOW else Color.YELLOW));

#   EMA of LOWS------------------------------------------------------------
plot LAvg = MovAvgExponential(Lprice[-Ldisplace], LLength);

LAvg.SetDefaultColor(Color.WHITE);
LAvg.SetLineWeight(5);
LAvg.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
LAvg.SetStyle(Curve.FIRM);
LAvg.HideBubble();
LAvg.HideTitle();

LAvg.AssignValueColor(if LAvg< LAvg[1] then Color.VIOLET else (if LAvg == LAvg[1] then Color.YELLOW else Color.YELLOW));

#   Crosses for SES Arrows----------------------------------------------
#   SES = Standard Entry Signal

#   Cross above High Average -----------------------------------------
def CrossUp = if price > HAvg AND price[1] < HAvg then 1 else 0;
Plot SESup = if CrossUp then high else double.nan;

SESup.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
SESup.SetLineWeight(3);
SESup.SetDefaultColor(color.YELLOW);
SESup.HideBubble();
SESup.HideTitle();

#   Cross above Low Average --------------------------------------------
def CrossDn = if price < Lavg AND price[1] > LAvg then 1 else 0;
Plot SESdn = if CrossDn then low else double.nan;

SESdn.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
SESdn.SetLineWeight(3);
SESdn.SetDefaultColor(color.VIOLET);
SESdn.HideBubble();
SESdn.HideTitle();

#   ================================================
#
#    Black Dog Arrows------------------------------------------------------

#   Change Aggregation Period to 20 minutes------------------------
def agg = AggregationPeriod.TWENTY_MIN;
def data = close(period = agg);

#   2 EMAs of Black Dogs--------------------------------------------------
def BDfastEMA=ExpAverage(DATA,20);
def BDslowEMA=ExpAverage(DATA,100);

#   Black Dog UP for EMA20 crossing ABOVE EMA100-------------
def UpCross = if BDfastEMA > BDslowEma AND BDfastEMA[1] < BDslowEMA then 1 else 0;
Plot BDup = if UpCross then high else double.nan;

BDup.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
BDup.SetLineWeight(5);
BDup.SetDefaultColor(color.WHITE);
BDup.HideBubble();
BDup.HideTitle();

#   Black Dog DN for EMA20 crossing BELOW EMA100-----------
def DnCross = if BDfastEMA < BDslowEma AND BDfastEMA[1] > BDslowEMA then 1 else 0;
Plot BDdn = if DnCross then low else double.nan;

BDdn.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
BDdn.SetLineWeight(5);
BDdn.SetDefaultColor(color.WHITE);
BDdn.HideBubble();
BDdn.HideTitle();

#   ================================================
#
#    State Transitions------------------------------------------------------

def LastXState;

if UpCross {
    LastXState = StateUp;
} else if DnCross {
    LastXState = StateDn;
} else {
    LastXState = LastXState[1];
}

AddLabel(1, "Last Cross Direction = " + if LastXState == StateUp then "UP" else if LastXState == StateDn then "DOWN" else "NOP",
    if LastXState == StateUp then Color.Green else if LastXState == StateDn then Color.Red else Color.Yellow);

#   END==========================================
# End Black Dogs & SESs---For 5 minute chart ONLY
 
Last edited:

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

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
513 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