• Memorial Day Sale! Claim the biggest discount of the year with $50 off VIP using code MEM50. Sign up here.

Black Dog System Indicator for ThinkorSwim - Strategy

BenTen

Administrative
Staff member
Staff
VIP
Attached is the Black Dog indicator for ThinkorSwim along with a strategy on how to use it. Black dog system is a trading strategy based on the moving averages (EMA) to plot the highs and lows band. I came across this while browsing the ThinkorSwim Yahoo group.

3R9fQZq.png


Some notes I found:

After reading through the Black Dog System literature, I came up with the following script that should be used ONLY for the 5 minute Time Frame. It uses and Exponential Moving Average (EMA) to plot the highs/lows band instead of the plain average. Yellowish and Blueish arrows are the SESs (Standard Entry Signal). Yellowish arrows for closes above the band and blueish arrows for closes below the band.

It plots WHITE Black Dogs, for both up and down crosses of the SLOW 100-period EMA by the Fast 20 period EMA instead of BLACK ones since I normally use a black background. These EMAs and their crosses are computed after changing the aggregation period to 20 minutes (4 times the base aggregation period of 5 minutes).

This script should be used only on 5 minute aggregation period charts. To use on a 15 or 60 minute chart, one should edit and rename this script and change the

Code:
def agg = AggregationPeriod.TWENTY_MIN;

line to

Code:
def agg = AggregationPeriod.HOUR;

or

Code:
def agg = AggregationPeriod.FOUR_HOURS;

There is not a 40-minute aggregation period constant for use with a 10-minute chart, but maybe one could use the "THIRTY_MIN" constant as a substitute.

thinkScript Code

Rich (BB code):
#   Black Dogs & SESs---For 5 minute chart ONLY
#   NAMED BlackDog_SES_5min

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

#   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();

#   END==========================================

Shareable Link

https://tos.mx/EpbpY9

How to Trade the Black Dog System

Some info below was found via this page. It was written to trade Forex but the concept remains relevant for trading stocks and options.

h7uuQpd.png


When to Buy (long):
  • Price should be within the moving average channel
  • An arrow pointing up right below the candle
  • MACD rising to the positive territory or EMA crossover (find what works for you)
  • Stop loss should be below the recent swing low
When to Sell (short):
  • Price should be within the moving average channel
  • An arrow pointing down
  • MACD dive to the negative territory or EMA crossover (find what works for you)
  • Stop loss should be above the recent swing high
 
Last edited:

mikeraya

New member
BenTen I had a question about the system as it applies to TOS. Supposedly the channels will go neutral when the market is moving sideways. However, I dont think the system that you gave us for TOS indicates a neutral period. Can you verify if it does or not? Thank you.

Great site you have put together with all the info on it. A great service for traders.

 
Last edited:

BenTen

Administrative
Staff member
Staff
VIP
@mikeraya A neutral period would be when the candlesticks are in between the two lines.

 
Last edited:

mikeraya

New member
was wondering how effective this system is with equities. Seems like you rarely see a Black Dog Arrow. On a few of the equites I looked at if printed four black dogs in a row. So does it work that well with equities vs. forex? Seems like the black dogs shouldnt be printing four in a row. Curious. Thank you

 
Last edited:

poparhon

New member
I added this Black Dog and my findings would be to plot Ichimoku and your results would be the same. When it changed colors , a TKx would happen.
 

Chimera777

New member
Attached is the Black Dog indicator for ThinkorSwim along with a strategy on how to use it. Black dog system is a trading strategy based on the moving averages (EMA) to plot the highs and lows band. I came across this while browsing the ThinkorSwim Yahoo group.

3R9fQZq.png


Some notes I found:



thinkScript Code

Rich (BB code):
#   Black Dogs & SESs---For 5 minute chart ONLY
#   NAMED BlackDog_SES_5min

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

#   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();

#   END==========================================

Shareable Link

https://tos.mx/EpbpY9

How to Trade the Black Dog System

Some info below was found via this page. It was written to trade Forex but the concept remains relevant for trading stocks and options.

h7uuQpd.png


When to Buy (long):
  • Price should be within the moving average channel
  • An arrow pointing up right below the candle
  • MACD rising to the positive territory or EMA crossover (find what works for you)
  • Stop loss should be below the recent swing low
When to Sell (short):
  • Price should be within the moving average channel
  • An arrow pointing down
  • MACD dive to the negative territory or EMA crossover (find what works for you)
  • Stop loss should be above the recent swing high
Hi Ben, Do you have a MACD with arrows like this one in the photo? Thanks
 

tomsk

Well-known member
VIP
@Chimera777 I'll respond on behalf of @BenTen
Per your request I have modified the standard TOS MACD study and added in the arrows you requested

Code:
# MACD with Arrows
# tomsk
# 12.6.2019

declare lower;

input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
input averageType = AverageType.EXPONENTIAL;
input showBreakoutSignals = no;

plot Value = MovingAverage(averageType, close, fastLength) - MovingAverage(averageType, close, slowLength);
plot Avg = MovingAverage(averageType, Value, MACDLength);

plot Diff = Value - Avg;
plot ZeroLine = 0;

plot UpSignal = if Diff crosses above ZeroLine then ZeroLine else Double.NaN;
plot DownSignal = if Diff crosses below ZeroLine then ZeroLine else Double.NaN;

UpSignal.SetHiding(!showBreakoutSignals);
DownSignal.SetHiding(!showBreakoutSignals);

Value.SetDefaultColor(GetColor(1));
Avg.SetDefaultColor(GetColor(8));
Diff.SetDefaultColor(GetColor(5));
Diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Diff.SetLineWeight(3);
Diff.DefineColor("Positive and Up", Color.GREEN);
Diff.DefineColor("Positive and Down", Color.DARK_GREEN);
Diff.DefineColor("Negative and Down", Color.RED);
Diff.DefineColor("Negative and Up", Color.DARK_RED);
Diff.AssignValueColor(if Diff >= 0 then if Diff > Diff[1] then Diff.color("Positive and Up") else Diff.color("Positive and Down") else if Diff < 

Diff[1] then Diff.color("Negative and Down") else Diff.color("Negative and Up"));
ZeroLine.SetDefaultColor(GetColor(0));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);

def buy = Diff crosses above 0;
def sell = Diff crosses below 0;
plot buySignal = if buy then 0 else Double.NaN;
plot sellSignal = if sell then 0 else Double.NaN;

buySignal.SetDefaultColor(Color.Cyan);
buySignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
buySignal.SetLineWeight(3);
buySignal.HideBubble();

sellSignal.SetDefaultColor(Color.Yellow);
sellSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
sellSignal.SetLineWeight(3);
sellSignal.HideBubble();
# End MACD with Arrows
 

hashy

Member
I read the file laketrader referenced above. It mentions that part of the Black Dog system is using a MACD set to 10,20,1 instead of the normal 12,26,9 (no big deal I can change that) but that also shows a 7 EMA of the MACD (NOT of the price). Anyone have this or able to easily code it? Please and thank you
 

tomsk

Well-known member
VIP
@hashy As you requested here is a custom MACD study, it is set at 10,20,1 and the Avg line is now set to 7 EMA of the MACD value.

Code:
# MACD with Arrows and Alerts (BlackDog Edition)
# tomsk
# 12.6.2019

declare lower;

input fastLength = 10;
input slowLength = 20;
input MACDLength = 1;
input BlackDogLength = 7;
input averageType = AverageType.EXPONENTIAL;
input showBreakoutSignals = no;

plot Value = MovingAverage(averageType, close, fastLength) - MovingAverage(averageType, close, slowLength);
plot Avg = MovingAverage(averageType, Value, BlackDogLength);

plot Diff = Value - Avg;
plot ZeroLine = 0;

plot UpSignal = if Diff crosses above ZeroLine then ZeroLine else Double.NaN;
plot DownSignal = if Diff crosses below ZeroLine then ZeroLine else Double.NaN;

UpSignal.SetHiding(!showBreakoutSignals);
DownSignal.SetHiding(!showBreakoutSignals);

Value.SetDefaultColor(GetColor(1));
Avg.SetDefaultColor(GetColor(8));
Diff.SetDefaultColor(GetColor(5));
Diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Diff.SetLineWeight(3);
Diff.DefineColor("Positive and Up", Color.GREEN);
Diff.DefineColor("Positive and Down", Color.DARK_GREEN);
Diff.DefineColor("Negative and Down", Color.RED);
Diff.DefineColor("Negative and Up", Color.DARK_RED);
Diff.AssignValueColor(if Diff >= 0 then if Diff > Diff[1] then Diff.color("Positive and Up") else Diff.color("Positive and Down") else if Diff < 

Diff[1] then Diff.color("Negative and Down") else Diff.color("Negative and Up"));
ZeroLine.SetDefaultColor(GetColor(0));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);

def buy = Diff crosses above 0;
def sell = Diff crosses below 0;
plot buySignal = if buy then 0 else Double.NaN;
plot sellSignal = if sell then 0 else Double.NaN;

buySignal.SetDefaultColor(Color.Cyan);
buySignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
buySignal.SetLineWeight(3);
buySignal.HideBubble();

sellSignal.SetDefaultColor(Color.Yellow);
sellSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
sellSignal.SetLineWeight(3);
sellSignal.HideBubble();

Alert(buySignal, "MACD Buy Signal", Alert.BAR, Sound.Ring);
Alert(sellSignal, "MACD Sell Signal", Alert.BAR, Sound.Bell);
# End MACD with Arrows and Alerts (BlackDog Edition)
[CODE]
 

hashy

Member
@hashy As you requested here is a custom MACD study, it is set at 10,20,1 and the Avg line is now set to 7 EMA of the MACD value.

I would say I owe you a beer, but I think at this point it's more like a couple bottles of good Bourbon. I greatly appreciate it!
 

tomsk

Well-known member
VIP
@hashy Glad it helped. Just to point out - you mentioned that BlackDog's settings are 10,20,1.
If you used those settings on my original version of that study, that means it will plot a 1 EMA of the MACD value.
The value "1" is only used in the computation of the Avg line.

You could very easily have achieved what you wanted by setting the MACD setting to 10,20,7 on the original version of the study (post #12)
Either approach you will see the exact same results.

Have a great weekend
 

Similar threads

Top