# Dr Wish's Black & Green Dot Indicator For ThinkOrSwim

#### mashume

##### Expert
VIP
Lifetime
I found some code I think is for the green dots... though I'm not entirely sure. Converted it below:
Code:
``````# Dr Wish's Black & Green Dot Indicator For ThinkOrSwim
# @Joshua 9/2021
# with green dots by mashume
# from TC2000 code found here: https://wishingwealthblog.com/2021/06/follow-on-to-traderlion-conference-this-wednesdays-long-island-talk-examples-of-black-dot-signals-gmi6-of-6/

def black =
Sum(StochasticFull(10,1) <= 25, 3) >= Yes
and close > close[1]
and (
close > Average(close,30)
or
close > expAverage(close,21)
)
;
plot bDot = if black then low else double.nan;
bDot.SetPaintingStrategy(paintingStrategy.POINTS);
bDot.setLineWeight(2);
bDot.setDefaultColor(color.black);

def green = if stochasticFull(10, 4)[1] < Average(StochasticFull(10, 4)[1], 4)
AND StochasticFull(10, 4) > Average(StochasticFull(10, 4), 4) then LOW else double.nan;

plot gDot = green;
gDot.SetPaintingStrategy(paintingStrategy.POINTS);
gDot.setLineWeight(2);
gDot.setDefaultColor(color.green);``````

Last edited by a moderator:
Hello, I am new to thinkscript and was wondering if someone can help code the black dot indicator as given by Dr. Wish in the below post:

https://wishingwealthblog.com/2021/...talk-examples-of-black-dot-signals-gmi6-of-6/

the relevant section of logic from that post is :

Black dot signals appear on my daily charts when a stock’s daily 10.1 stochastic was <=25 in any of the past 3 days, has a current price >prior day’s price, and is currently above either its 30 day average or its exp 21 day average. This is what the formula looks like for TC2000 to put the black dot on the chart. My co-instructor has posted a tutorial video (see below) showing how to put green dot signals on a chart and it can be modified with this formula to place the black dot.

Appreciate if we can have the code for both an indicator on the chart and a scan.

Thanks!

Dr Wish's Black Dot Indicator For ThinkOrSwim

Ruby:
``````# Dr Wish's Black Dot Indicator For ThinkOrSwim
# @Joshua 9/2021

def bDot =
Sum(StochasticFull(10,1) <= 25, 3) >= Yes
and close > close[1]
and (
close > Average(close,30)
or
close > expAverage(close,21)
)
;
plot Dot = if bDot then low else double.nan;
Dot.SetPaintingStrategy(paintingStrategy.POINTS);
Dot.setLineWeight(5);
Dot.setDefaultColor(color.black);``````

Last edited by a moderator:
I could use some help getting this code ported to TOS. I don't know if anyone in here follows the WISHING WEALTH BLOG, but he uses TC2000 for his charting package. Well today someone posted how to build a couple of indicators (his green dot and black dot indicators) that he uses in TC2000. Here is the link to the short video with the code

Any help moving the code to TOS would be appreciated.

Thank you.

@car9999 Try out the post above yours.

Thanks for directing me to the code above. I tried to coble something together for the Green Dot, but my attempts at cutting and pasting code went nowhere.

Question: How do you attach a screenshot here? I tried including a http file from Snagit, but this program does like doing that....

Question, is there a scan that goes with this study?

Dr Wish's Black Dot Indicator For ThinkOrSwim

Ruby:
``````# Dr Wish's Black Dot Indicator For ThinkOrSwim
# @Joshua 9/2021

def bDot =
Sum(StochasticFull(10,1) <= 25, 3) >= Yes
and close > close[1]
and (
close > Average(close,30)
or
close > expAverage(close,21)
)
;
plot Dot = if bDot then low else double.nan;
Dot.SetPaintingStrategy(paintingStrategy.POINTS);
Dot.setLineWeight(5);
Dot.setDefaultColor(color.black);``````
View attachment 981
Do you have this in a shared file ?

Me? No. I haven't seen this code since I wrote it.

Does anyone have the code for the lower stochastic indicator, or the setting to make one work with the green dot?
I have tried several different stochastics and different setting on them all to no avail.
Thank you to all who have contributed

I put this together from a screen shot of some source code I found somewhere...
Code:
``````# Dr Wish's Black Dot Indicator For ThinkOrSwim
# @Joshua 9/2021
# with green dots by mashume from mystery code

def black =
Sum(StochasticFull(10,1) <= 25, 3) >= Yes
and close > close[1]
and (
close > Average(close,30)
or
close > expAverage(close,21)
)
;
plot bDot = if black then low else double.nan;
bDot.SetPaintingStrategy(paintingStrategy.POINTS);
bDot.setLineWeight(2);
bDot.setDefaultColor(color.black);

def green = if stochasticFull(10, 4)[1] < Average(StochasticFull(10, 4)[1], 4)
AND StochasticFull(10, 4) > Average(StochasticFull(10, 4), 4) then LOW else double.nan;

plot gDot = green;
gDot.SetPaintingStrategy(paintingStrategy.POINTS);
gDot.setLineWeight(2);
gDot.setDefaultColor(color.greeN);``````

but don't ask me where I found it.

-mashume

I put this together from a screen shot of some source code I found somewhere...
Code:
``````# Dr Wish's Black Dot Indicator For ThinkOrSwim
# @Joshua 9/2021
# with green dots by mashume from mystery code

def black =
Sum(StochasticFull(10,1) <= 25, 3) >= Yes
and close > close[1]
and (
close > Average(close,30)
or
close > expAverage(close,21)
)
;
plot bDot = if black then low else double.nan;
bDot.SetPaintingStrategy(paintingStrategy.POINTS);
bDot.setLineWeight(2);
bDot.setDefaultColor(color.black);

def green = if stochasticFull(10, 4)[1] < Average(StochasticFull(10, 4)[1], 4)
AND StochasticFull(10, 4) > Average(StochasticFull(10, 4), 4) then LOW else double.nan;

plot gDot = green;
gDot.SetPaintingStrategy(paintingStrategy.POINTS);
gDot.setLineWeight(2);
gDot.setDefaultColor(color.greeN);``````

but don't ask me where I found it.

-mashume
wow, thank you for such a quick replay, i think this is the same code as the first code post in this thread, this one doesnt have the lower indicator

wow, thank you for such a quick replay, i think this is the same code as the first code post in this thread, this one doesnt have the lower indicator
Sorry, this has the green dots. Not the lower. my bad. long day

-mashume

Sorry, this has the green dots. Not the lower. my bad. long day

-mashume
Thank you for trying though

I believe i have gotten pretty close with the lower indicator for the Green Dot, but i have not look into the Black Dot but here is the code for lower indicator if anyone is interested, also if anyone is able improve on this it would be greatly appreciated

Code:
``````declare lower;

# Base code by TD Ameritrade IP Company, Inc. (c) 2008-2021

input over_bought = 80;
input over_sold = 50;
input KPeriod = 10.4;
input DPeriod = 4;
input priceH = high;
input priceL = low;
input priceC = close;
input slowing_period = 3;
input averageType = AverageType.SIMPLE;
input showBreakoutSignals = {default "No", "On FullK", "On FullD", "On FullK & FullD"};

def lowest_k = Lowest(priceL, KPeriod);
def c1 = priceC - lowest_k;
def c2 = Highest(priceH, KPeriod) - lowest_k;
def FastK = if c2 != 0 then c1 / c2 * 100 else 0;

plot FullK = MovingAverage(averageType, FastK, slowing_period);
plot FullD = MovingAverage(averageType, FullK, DPeriod);

plot OverBought = over_bought;
plot OverSold = over_sold;

# signal

def fullKCrossesFromoverbought= FullK[1] > 80 and FullK < 80;
def fullKCrossesBelowFullD = FullK[1] > FullD[1] and FullK < FullD;
plot signaldown = fullKCrossesFromoverbought and fullKCrossesBelowFullD;
signaldown.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_down);
signaldown.SetDefaultColor(Color.magenta);

def fullKCrossesFromoversold = FullK[1] < 20 and FullK > 20;
def fullKCrossesAboveFullD = FullK[1] < FullD[1] and FullK > FullD;
plot signalup = fullKCrossesFromoversold and fullKCrossesAboveFullD;
signalup.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
signalup.SetDefaultColor(Color.cyan);;``````

This looked interesting so thought I would muck about with it a little. Found a few other articles on this system and added in their suggestions. Such as the 30 week avg for buy condition. The 21 exp and 30 sma for black dot condition visuals. As well as 5 day low marker at dot signals for the support level / entry exit stop if trade fails. Chartbubbles for the dot signals only appear if signal in previous 5 days (to reduce clutter) can be turned off.

I changed the black dots to magenta to be seen easier on my dark chart background. Also changed the black (magenta) dots to triangles to be able to detect easier when they overlap green dots at the same spot.

Modified stoch lower panel includes green cloud as preferred buy zone between 50 and 25. Fast crossing (up / down) slow signal arrows.

Red and blue exponential ribbons for trend detection in separate chart window .

Ideas from
https://wishingwealthblog.com/2018/03/green-dot-strategy-defined/
as well as the Red White Blue ribbons from
https://wishingwealthblog.com/glossary/
mentioned in
https://aaiidcmetro.com/slides/(2019-07-13)wish.pdf

Basically three chunks of code.
1)Main chart with green / black dots
2)Lower panel of main chart has modified stoch
3)Side chart with ribbon code

Screen setup FlexChart at the moment consists of main window - left 2/3rds of screen with green / black dots and lower panel with modified stochastic. The right 1/3 screen side window chart has the RWB ribbon (to reduce main chart clutter).

First time sharing chart, hope it works http://tos.mx/aA8Yizg

Main chart code.
Code:
``````# Jan 2022 my mucking about with code from mashume
# https://usethinkscript.com/threads/dr-wishs-black-green-dot-indicator-for-thinkorswim.8110/
# to include stuff from
# https://wishingwealthblog.com/2018/03/green-dot-strategy-defined/
# https://aaiidcmetro.com/slides/(2019-07-13)wish.pdf
# https://wishingwealthblog.com/glossary/

# Dr Wish's Black & Green Dot Indicator For ThinkOrSwim
# @Joshua 9/2021
# with green dots by mashume
# from TC2000 code found here: https://wishingwealthblog.com/2021/06/follow-on-to-traderlion-conference-this-wednesdays-long-island-talk-examples-of-black-dot-signals-gmi6-of-6/

def black =
Sum(StochasticFull(10,1) <= 25, 3) >= Yes
and close > close[1]
and (close > Average(close,30)
or
close > expAverage(close,21)
)
;

# Added the Stoch suggested cross over up to occur at oversold values less than 50.
def green = if stochasticFull(10, 4)[1] < Average(StochasticFull(10, 4)[1], 4)
and stochasticFull(10, 4) < 50
AND StochasticFull(10, 4) > Average(StochasticFull(10, 4), 4) then low else double.nan;

plot bDot = if black then low else double.nan;
bDot.SetPaintingStrategy(paintingStrategy.triangles);
bDot.setLineWeight(3);
bDot.setDefaultColor(color.magenta); # instead of black to show on black chart background

plot gDot = green;
gDot.SetPaintingStrategy(paintingStrategy.POINTS);
gDot.setLineWeight(3);
gDot.setDefaultColor(color.lime); #green

# ---  Finding lowest 5 day value for possible support level and entry stop out if trade fails.
# ---  ToS only compares two values at a time.
def A = Min(low, low[1]);
def B = Min(low[2], low[3]);
def C = Min(A, B);
def D = Min(C, low[4]);

# -- to show only current few (5) days worth of level stop bubbles, reduce clutter
def plotThis =  if getday() >= (getlastday() - 5) and GetLastYear() == GetYear() then 1 else 0;

# -- extra dots for lookback stop value
plot bDotLB = if black then D else double.nan;
bDotLB.SetPaintingStrategy(paintingStrategy.Horizontal); #triangle in case they overlap green dot
bDotLB.setLineWeight(2);
bDotLB.setDefaultColor(color.magenta); # instead of black to show on black chart background

plot gDotLB = if green then D else Double.NaN;
gDotLB.SetPaintingStrategy(paintingStrategy.Horizontal);
gDotLB.setLineWeight(2);
gDotLB.setDefaultColor(color.lime); #green

input ShowBubbles = yes;
AddChartBubble(ShowBubbles and plotThis == 1 and green, D, "Support / \n Stop: " +D+ "", Color.lime, no);
AddChartBubble(ShowBubbles and plotThis == 1 and black, D, "Support / \n Stop: " +D+ "", Color.magenta, no);

# -- 30 week avg for Dr Wish, one of the conditions for determining trend.  Stock should be above.
def agg = AggregationPeriod.WEEK;
def ThirtyWeek = close(period = agg);
plot wk30sma = Average(ThirtyWeek, 30);
wk30sma.setDefaultColor(color.light_green);
AddLabel(close > wk30sma, " Above 30wk sma ", color.green);
AddLabel(close < wk30sma, " Below 30wk sma ", color.pink);

# -- moving avgs for black dot confirmation
input ShowBlkDotMA = yes;
plot BlkDtsma = if ShowBlkDotMA then Average(close, 30) else Double.nan;
plot BlkDtexp = if ShowBlkDotMA then ExpAverage(close, 21) else Double.nan;

# -- Green Line BreakOut -- Monthly timeframe, all time high not surpassed for 3 months
def aggM = AggregationPeriod.Month;
plot GLBO =  High(period = aggM);
GLBO.SetPaintingStrategy(paintingStrategy.Horizontal);
GLBO.setLineWeight(2);
GLBO.setDefaultColor(color.green);

# --- Find yearly low of stock, want price to double from it's lowest price over the past year
def YearLow = Lowest(Low, 261); # 52weeks x 2day weekend = 104, 365-104 = roughly 261 trading days in a year
AddLabel(yes, " Yearly Low: " +round(YearLow, 2)+  ", x2 = "  +round(YearLow, 2)* 2+ ", Current: " +round(close, 2)+ "", color.light_gray);

#-- Percentage from YearlyLow
def data = close;
def avg = YearLow;
def pct = (data/avg) - 1;
AddLabel(yes, "% change from YearLow of " +round(YearLow, 2)+ " is " + AsPercent(pct)+ "" , if pct > 1 then Color.GREEN else Color.PINK);``````

lower panel modified stoch
Code:
``````# Jan 2022 my mucking about with code from mashume
# https://usethinkscript.com/threads/dr-wishs-black-green-dot-indicator-for-thinkorswim.8110/
# to include stuff from
# https://wishingwealthblog.com/2018/03/green-dot-strategy-defined/
# https://aaiidcmetro.com/slides/(2019-07-13)wish.pdf
# https://wishingwealthblog.com/glossary/

#
# TD Ameritrade IP Company, Inc. (c) 2008-2021
#

declare lower;

input over_bought = 80;
input over_sold = 20;
input KPeriod = 10;
input DPeriod = 10;
input priceH = high;
input priceL = low;
input priceC = close;
input slowing_period = 3;
input averageType = AverageType.SIMPLE;
input showBreakoutSignals = {default "No", "On FullK", "On FullD", "On FullK & FullD"};

def lowest_k = Lowest(priceL, KPeriod);
def c1 = priceC - lowest_k;
def c2 = Highest(priceH, KPeriod) - lowest_k;
def FastK = if c2 != 0 then c1 / c2 * 100 else 0;

plot FullK = MovingAverage(averageType, FastK, slowing_period);
plot FullD = MovingAverage(averageType, FullK, DPeriod);

plot OverBought = over_bought;
plot OverSold = over_sold;

#def upK = FullK crosses above OverSold;
#def downK = FullK crosses below OverBought;
#  Green Dot criteria
def upK = FullK < 50 and FullK crosses above FullD;
def downK = FullK crosses below FullD;

def upD = FullD crosses above OverSold;
def downD = FullD crosses below OverBought;

plot UpSignal;
plot DownSignal;
switch (showBreakoutSignals) {
case "No":
UpSignal = Double.NaN;
DownSignal = Double.NaN;
case "On FullK":
UpSignal = if upK then OverSold else Double.NaN;
DownSignal = if downK then OverBought else Double.NaN;
case "On FullD":
UpSignal = if upD then OverSold else Double.NaN;
DownSignal = if downD then OverBought else Double.NaN;
case "On FullK & FullD":
UpSignal = if upK or upD then OverSold else Double.NaN;
DownSignal = if downK or downD then OverBought else Double.NaN;
}

plot FiftyMark = 50;
FiftyMark.setDefaultColor(color.light_green);

AddCloud(25, 50, color.light_green, color.light_green);

UpSignal.setHiding(showBreakoutSignals == showBreakoutSignals."No");
DownSignal.setHiding(showBreakoutSignals == showBreakoutSignals."No");

FullK.SetDefaultColor(GetColor(5));
FullD.SetDefaultColor(GetColor(0));
OverBought.SetDefaultColor(GetColor(1));
OverSold.SetDefaultColor(GetColor(1));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);``````

side window ribbons
Code:
``````# Jan 2022 my mucking about with code from mashume
# https://usethinkscript.com/threads/dr-wishs-black-green-dot-indicator-for-thinkorswim.8110/
# to include stuff from
# https://wishingwealthblog.com/2018/03/green-dot-strategy-defined/
# https://aaiidcmetro.com/slides/(2019-07-13)wish.pdf
# https://wishingwealthblog.com/glossary/

# -- 30 week avg for Dr Wish, one of the conditions for determining trend.  Stock should be above.
def agg = AggregationPeriod.WEEK;
def ThirtyWeek = close(period = agg);
plot wk30sma = Average(ThirtyWeek, 30);
wk30sma.setDefaultColor(color.light_green);
AddLabel(close > wk30sma, " Above 30wk sma ", color.green);
AddLabel(close < wk30sma, " Below 30wk sma ", color.pink);

# -- Red White and Blue exp avg ribbons
# -- Prefer seeing all red avgs as a ribbon with white chart background space above blue avgs ribbon.
# -- Strong pattern all avgs lined up with each above the next longer avg and the close leading them all higher.
# -- Red ribbons
plot Red3 = ExpAverage(close, 3);
Red3.setDefaultColor(color.pink);
plot Red5 = ExpAverage(close, 5);
Red5.setDefaultColor(color.pink);
plot Red8 = ExpAverage(close, 8);
Red8.setDefaultColor(color.pink);
plot Red10 = ExpAverage(close, 10);
Red10.setDefaultColor(color.pink);
plot Red12 = ExpAverage(close, 12);
Red12.setDefaultColor(color.pink);
plot Red15 = ExpAverage(close, 15);
Red15.setDefaultColor(color.pink);

# -- Blue ribbons
plot Blue30 = ExpAverage(close, 30);
Blue30.setDefaultColor(color.cyan);
plot Blue35 = ExpAverage(close, 35);
Blue35.setDefaultColor(color.cyan);
plot Blue40 = ExpAverage(close, 40);
Blue40.setDefaultColor(color.cyan);
plot Blue45 = ExpAverage(close, 45);
Blue45.setDefaultColor(color.cyan);
plot Blue50 = ExpAverage(close, 50);
Blue50.setDefaultColor(color.cyan);
plot Blue60 = ExpAverage(close, 60);
Blue60.setDefaultColor(color.cyan);

# -- close, prefer above the ribbons.
plot ClosePrice = close;
ClosePrice.setDefaultColor(color.white);
#ClosePrice.SetPaintingStrategy(paintingStrategy.Dashes);
ClosePrice.setLineWeight(2);``````

Only had this running a few days so not thoroughly tested.

Edit: Added in Green Line BreakOut extra from later posting, thanks lmk99.
2-6-2022 Also added in Labels for YearlyLow and percentage to current price.

Last edited by a moderator:
This looked interesting so thought I would muck about with it a little. Found a few other articles on this system and added in their suggestions. Such as the 30 week avg for buy condition. The 21 exp and 30 sma for black dot condition visuals. As well as 5 day low marker at dot signals for the support level / entry exit stop if trade fails. Chartbubbles for the dot signals only appear if signal in previous 5 days (to reduce clutter) can be turned off.

I changed the black dots to magenta to be seen easier on my dark chart background. Also changed the black (magenta) dots to triangles to be able to detect easier when they overlap green dots at the same spot.

Modified stoch lower panel includes green cloud as preferred buy zone between 50 and 25. Fast crossing (up / down) slow signal arrows.

Red and blue exponential ribbons for trend detection in separate chart window .

Ideas from
https://wishingwealthblog.com/2018/03/green-dot-strategy-defined/
as well as the Red White Blue ribbons from
https://wishingwealthblog.com/glossary/
mentioned in
https://aaiidcmetro.com/slides/(2019-07-13)wish.pdf

Basically three chunks of code.
1)Main chart with green / black dots
2)Lower panel of main chart has modified stoch
3)Side chart with ribbon code

Screen setup FlexChart at the moment consists of main window - left 2/3rds of screen with green / black dots and lower panel with modified stochastic. The right 1/3 screen side window chart has the RWB ribbon (to reduce main chart clutter).

First time sharing chart, hope it works http://tos.mx/aA8Yizg

Main chart code.
Code:
``````# Jan 2022 my mucking about with code from mashume
# https://usethinkscript.com/threads/dr-wishs-black-green-dot-indicator-for-thinkorswim.8110/
# to include stuff from
# https://wishingwealthblog.com/2018/03/green-dot-strategy-defined/
# https://aaiidcmetro.com/slides/(2019-07-13)wish.pdf
# https://wishingwealthblog.com/glossary/

# Dr Wish's Black & Green Dot Indicator For ThinkOrSwim
# @Joshua 9/2021
# with green dots by mashume
# from TC2000 code found here: https://wishingwealthblog.com/2021/06/follow-on-to-traderlion-conference-this-wednesdays-long-island-talk-examples-of-black-dot-signals-gmi6-of-6/

def black =
Sum(StochasticFull(10,1) <= 25, 3) >= Yes
and close > close[1]
and (close > Average(close,30)
or
close > expAverage(close,21)
)
;

# Added the Stoch suggested cross over up to occur at oversold values less than 50.
def green = if stochasticFull(10, 4)[1] < Average(StochasticFull(10, 4)[1], 4)
and stochasticFull(10, 4) < 50
AND StochasticFull(10, 4) > Average(StochasticFull(10, 4), 4) then low else double.nan;

plot bDot = if black then low else double.nan;
bDot.SetPaintingStrategy(paintingStrategy.triangles);
bDot.setLineWeight(3);
bDot.setDefaultColor(color.magenta); # instead of black to show on black chart background

plot gDot = green;
gDot.SetPaintingStrategy(paintingStrategy.POINTS);
gDot.setLineWeight(3);
gDot.setDefaultColor(color.lime); #green

# ---  Finding lowest 5 day value for possible support level and entry stop out if trade fails.
# ---  ToS only compares two values at a time.
def A = Min(low, low[1]);
def B = Min(low[2], low[3]);
def C = Min(A, B);
def D = Min(C, low[4]);

# -- to show only current few (5) days worth of level stop bubbles, reduce clutter
def plotThis =  if getday() >= (getlastday() - 5) and GetLastYear() == GetYear() then 1 else 0;

# -- extra dots for lookback stop value
plot bDotLB = if black then D else double.nan;
bDotLB.SetPaintingStrategy(paintingStrategy.Horizontal); #triangle in case they overlap green dot
bDotLB.setLineWeight(2);
bDotLB.setDefaultColor(color.magenta); # instead of black to show on black chart background

plot gDotLB = if green then D else Double.NaN;
gDotLB.SetPaintingStrategy(paintingStrategy.Horizontal);
gDotLB.setLineWeight(2);
gDotLB.setDefaultColor(color.lime); #green

input ShowBubbles = yes;
AddChartBubble(ShowBubbles and plotThis == 1 and green, D, "Support / \n Stop: " +D+ "", Color.lime, no);
AddChartBubble(ShowBubbles and plotThis == 1 and black, D, "Support / \n Stop: " +D+ "", Color.magenta, no);

# -- 30 week avg for Dr Wish, one of the conditions for determining trend.  Stock should be above.
def agg = AggregationPeriod.WEEK;
def ThirtyWeek = close(period = agg);
plot wk30sma = Average(ThirtyWeek, 30);
wk30sma.setDefaultColor(color.light_green);
AddLabel(close > wk30sma, " Above 30wk sma ", color.green);
AddLabel(close < wk30sma, " Below 30wk sma ", color.pink);

# -- moving avgs for black dot confirmation
input ShowBlkDotMA = yes;
plot BlkDtsma = if ShowBlkDotMA then Average(close, 30) else Double.nan;
plot BlkDtexp = if ShowBlkDotMA then ExpAverage(close, 21) else Double.nan;``````

lower panel modified stoch
Code:
``````# Jan 2022 my mucking about with code from mashume
# https://usethinkscript.com/threads/dr-wishs-black-green-dot-indicator-for-thinkorswim.8110/
# to include stuff from
# https://wishingwealthblog.com/2018/03/green-dot-strategy-defined/
# https://aaiidcmetro.com/slides/(2019-07-13)wish.pdf
# https://wishingwealthblog.com/glossary/

#
# TD Ameritrade IP Company, Inc. (c) 2008-2021
#

declare lower;

input over_bought = 80;
input over_sold = 20;
input KPeriod = 10;
input DPeriod = 10;
input priceH = high;
input priceL = low;
input priceC = close;
input slowing_period = 3;
input averageType = AverageType.SIMPLE;
input showBreakoutSignals = {default "No", "On FullK", "On FullD", "On FullK & FullD"};

def lowest_k = Lowest(priceL, KPeriod);
def c1 = priceC - lowest_k;
def c2 = Highest(priceH, KPeriod) - lowest_k;
def FastK = if c2 != 0 then c1 / c2 * 100 else 0;

plot FullK = MovingAverage(averageType, FastK, slowing_period);
plot FullD = MovingAverage(averageType, FullK, DPeriod);

plot OverBought = over_bought;
plot OverSold = over_sold;

#def upK = FullK crosses above OverSold;
#def downK = FullK crosses below OverBought;
#  Green Dot criteria
def upK = FullK < 50 and FullK crosses above FullD;
def downK = FullK crosses below FullD;

def upD = FullD crosses above OverSold;
def downD = FullD crosses below OverBought;

plot UpSignal;
plot DownSignal;
switch (showBreakoutSignals) {
case "No":
UpSignal = Double.NaN;
DownSignal = Double.NaN;
case "On FullK":
UpSignal = if upK then OverSold else Double.NaN;
DownSignal = if downK then OverBought else Double.NaN;
case "On FullD":
UpSignal = if upD then OverSold else Double.NaN;
DownSignal = if downD then OverBought else Double.NaN;
case "On FullK & FullD":
UpSignal = if upK or upD then OverSold else Double.NaN;
DownSignal = if downK or downD then OverBought else Double.NaN;
}

plot FiftyMark = 50;
FiftyMark.setDefaultColor(color.light_green);

AddCloud(25, 50, color.light_green, color.light_green);

UpSignal.setHiding(showBreakoutSignals == showBreakoutSignals."No");
DownSignal.setHiding(showBreakoutSignals == showBreakoutSignals."No");

FullK.SetDefaultColor(GetColor(5));
FullD.SetDefaultColor(GetColor(0));
OverBought.SetDefaultColor(GetColor(1));
OverSold.SetDefaultColor(GetColor(1));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);``````

side window ribbons
Code:
``````# Jan 2022 my mucking about with code from mashume
# https://usethinkscript.com/threads/dr-wishs-black-green-dot-indicator-for-thinkorswim.8110/
# to include stuff from
# https://wishingwealthblog.com/2018/03/green-dot-strategy-defined/
# https://aaiidcmetro.com/slides/(2019-07-13)wish.pdf
# https://wishingwealthblog.com/glossary/

# -- 30 week avg for Dr Wish, one of the conditions for determining trend.  Stock should be above.
def agg = AggregationPeriod.WEEK;
def ThirtyWeek = close(period = agg);
plot wk30sma = Average(ThirtyWeek, 30);
wk30sma.setDefaultColor(color.light_green);
AddLabel(close > wk30sma, " Above 30wk sma ", color.green);
AddLabel(close < wk30sma, " Below 30wk sma ", color.pink);

# -- Red White and Blue exp avg ribbons
# -- Prefer seeing all red avgs as a ribbon with white chart background space above blue avgs ribbon.
# -- Strong pattern all avgs lined up with each above the next longer avg and the close leading them all higher.
# -- Red ribbons
plot Red3 = ExpAverage(close, 3);
Red3.setDefaultColor(color.pink);
plot Red5 = ExpAverage(close, 5);
Red5.setDefaultColor(color.pink);
plot Red8 = ExpAverage(close, 8);
Red8.setDefaultColor(color.pink);
plot Red10 = ExpAverage(close, 10);
Red10.setDefaultColor(color.pink);
plot Red12 = ExpAverage(close, 12);
Red12.setDefaultColor(color.pink);
plot Red15 = ExpAverage(close, 15);
Red15.setDefaultColor(color.pink);

# -- Blue ribbons
plot Blue30 = ExpAverage(close, 30);
Blue30.setDefaultColor(color.cyan);
plot Blue35 = ExpAverage(close, 35);
Blue35.setDefaultColor(color.cyan);
plot Blue40 = ExpAverage(close, 40);
Blue40.setDefaultColor(color.cyan);
plot Blue45 = ExpAverage(close, 45);
Blue45.setDefaultColor(color.cyan);
plot Blue50 = ExpAverage(close, 50);
Blue50.setDefaultColor(color.cyan);
plot Blue60 = ExpAverage(close, 60);
Blue60.setDefaultColor(color.cyan);

# -- close, prefer above the ribbons.
plot ClosePrice = close;
ClosePrice.setDefaultColor(color.white);
#ClosePrice.SetPaintingStrategy(paintingStrategy.Dashes);
ClosePrice.setLineWeight(2);``````

Only had this running a few days so not thoroughly tested.
Thank you for that lower code modification, i love the shaded area between 25 and 50, makes a nice visual

This looked interesting so thought I would muck about with it a little. Found a few other articles on this system and added in their suggestions. Such as the 30 week avg for buy condition. The 21 exp and 30 sma for black dot condition visuals. As well as 5 day low marker at dot signals for the support level / entry exit stop if trade fails. Chartbubbles for the dot signals only appear if signal in previous 5 days (to reduce clutter) can be turned off.

I changed the black dots to magenta to be seen easier on my dark chart background. Also changed the black (magenta) dots to triangles to be able to detect easier when they overlap green dots at the same spot.

Modified stoch lower panel includes green cloud as preferred buy zone between 50 and 25. Fast crossing (up / down) slow signal arrows.

Red and blue exponential ribbons for trend detection in separate chart window .

Ideas from
https://wishingwealthblog.com/2018/03/green-dot-strategy-defined/
as well as the Red White Blue ribbons from
https://wishingwealthblog.com/glossary/
mentioned in
https://aaiidcmetro.com/slides/(2019-07-13)wish.pdf

Basically three chunks of code.
1)Main chart with green / black dots
2)Lower panel of main chart has modified stoch
3)Side chart with ribbon code

Screen setup FlexChart at the moment consists of main window - left 2/3rds of screen with green / black dots and lower panel with modified stochastic. The right 1/3 screen side window chart has the RWB ribbon (to reduce main chart clutter).

First time sharing chart, hope it works http://tos.mx/aA8Yizg

Main chart code.
Code:
``````# Jan 2022 my mucking about with code from mashume
# https://usethinkscript.com/threads/dr-wishs-black-green-dot-indicator-for-thinkorswim.8110/
# to include stuff from
# https://wishingwealthblog.com/2018/03/green-dot-strategy-defined/
# https://aaiidcmetro.com/slides/(2019-07-13)wish.pdf
# https://wishingwealthblog.com/glossary/

# Dr Wish's Black & Green Dot Indicator For ThinkOrSwim
# @Joshua 9/2021
# with green dots by mashume
# from TC2000 code found here: https://wishingwealthblog.com/2021/06/follow-on-to-traderlion-conference-this-wednesdays-long-island-talk-examples-of-black-dot-signals-gmi6-of-6/

def black =
Sum(StochasticFull(10,1) <= 25, 3) >= Yes
and close > close[1]
and (close > Average(close,30)
or
close > expAverage(close,21)
)
;

# Added the Stoch suggested cross over up to occur at oversold values less than 50.
def green = if stochasticFull(10, 4)[1] < Average(StochasticFull(10, 4)[1], 4)
and stochasticFull(10, 4) < 50
AND StochasticFull(10, 4) > Average(StochasticFull(10, 4), 4) then low else double.nan;

plot bDot = if black then low else double.nan;
bDot.SetPaintingStrategy(paintingStrategy.triangles);
bDot.setLineWeight(3);
bDot.setDefaultColor(color.magenta); # instead of black to show on black chart background

plot gDot = green;
gDot.SetPaintingStrategy(paintingStrategy.POINTS);
gDot.setLineWeight(3);
gDot.setDefaultColor(color.lime); #green

# ---  Finding lowest 5 day value for possible support level and entry stop out if trade fails.
# ---  ToS only compares two values at a time.
def A = Min(low, low[1]);
def B = Min(low[2], low[3]);
def C = Min(A, B);
def D = Min(C, low[4]);

# -- to show only current few (5) days worth of level stop bubbles, reduce clutter
def plotThis =  if getday() >= (getlastday() - 5) and GetLastYear() == GetYear() then 1 else 0;

# -- extra dots for lookback stop value
plot bDotLB = if black then D else double.nan;
bDotLB.SetPaintingStrategy(paintingStrategy.Horizontal); #triangle in case they overlap green dot
bDotLB.setLineWeight(2);
bDotLB.setDefaultColor(color.magenta); # instead of black to show on black chart background

plot gDotLB = if green then D else Double.NaN;
gDotLB.SetPaintingStrategy(paintingStrategy.Horizontal);
gDotLB.setLineWeight(2);
gDotLB.setDefaultColor(color.lime); #green

input ShowBubbles = yes;
AddChartBubble(ShowBubbles and plotThis == 1 and green, D, "Support / \n Stop: " +D+ "", Color.lime, no);
AddChartBubble(ShowBubbles and plotThis == 1 and black, D, "Support / \n Stop: " +D+ "", Color.magenta, no);

# -- 30 week avg for Dr Wish, one of the conditions for determining trend.  Stock should be above.
def agg = AggregationPeriod.WEEK;
def ThirtyWeek = close(period = agg);
plot wk30sma = Average(ThirtyWeek, 30);
wk30sma.setDefaultColor(color.light_green);
AddLabel(close > wk30sma, " Above 30wk sma ", color.green);
AddLabel(close < wk30sma, " Below 30wk sma ", color.pink);

# -- moving avgs for black dot confirmation
input ShowBlkDotMA = yes;
plot BlkDtsma = if ShowBlkDotMA then Average(close, 30) else Double.nan;
plot BlkDtexp = if ShowBlkDotMA then ExpAverage(close, 21) else Double.nan;``````

lower panel modified stoch
Code:
``````# Jan 2022 my mucking about with code from mashume
# https://usethinkscript.com/threads/dr-wishs-black-green-dot-indicator-for-thinkorswim.8110/
# to include stuff from
# https://wishingwealthblog.com/2018/03/green-dot-strategy-defined/
# https://aaiidcmetro.com/slides/(2019-07-13)wish.pdf
# https://wishingwealthblog.com/glossary/

#
# TD Ameritrade IP Company, Inc. (c) 2008-2021
#

declare lower;

input over_bought = 80;
input over_sold = 20;
input KPeriod = 10;
input DPeriod = 10;
input priceH = high;
input priceL = low;
input priceC = close;
input slowing_period = 3;
input averageType = AverageType.SIMPLE;
input showBreakoutSignals = {default "No", "On FullK", "On FullD", "On FullK & FullD"};

def lowest_k = Lowest(priceL, KPeriod);
def c1 = priceC - lowest_k;
def c2 = Highest(priceH, KPeriod) - lowest_k;
def FastK = if c2 != 0 then c1 / c2 * 100 else 0;

plot FullK = MovingAverage(averageType, FastK, slowing_period);
plot FullD = MovingAverage(averageType, FullK, DPeriod);

plot OverBought = over_bought;
plot OverSold = over_sold;

#def upK = FullK crosses above OverSold;
#def downK = FullK crosses below OverBought;
#  Green Dot criteria
def upK = FullK < 50 and FullK crosses above FullD;
def downK = FullK crosses below FullD;

def upD = FullD crosses above OverSold;
def downD = FullD crosses below OverBought;

plot UpSignal;
plot DownSignal;
switch (showBreakoutSignals) {
case "No":
UpSignal = Double.NaN;
DownSignal = Double.NaN;
case "On FullK":
UpSignal = if upK then OverSold else Double.NaN;
DownSignal = if downK then OverBought else Double.NaN;
case "On FullD":
UpSignal = if upD then OverSold else Double.NaN;
DownSignal = if downD then OverBought else Double.NaN;
case "On FullK & FullD":
UpSignal = if upK or upD then OverSold else Double.NaN;
DownSignal = if downK or downD then OverBought else Double.NaN;
}

plot FiftyMark = 50;
FiftyMark.setDefaultColor(color.light_green);

AddCloud(25, 50, color.light_green, color.light_green);

UpSignal.setHiding(showBreakoutSignals == showBreakoutSignals."No");
DownSignal.setHiding(showBreakoutSignals == showBreakoutSignals."No");

FullK.SetDefaultColor(GetColor(5));
FullD.SetDefaultColor(GetColor(0));
OverBought.SetDefaultColor(GetColor(1));
OverSold.SetDefaultColor(GetColor(1));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);``````

side window ribbons
Code:
``````# Jan 2022 my mucking about with code from mashume
# https://usethinkscript.com/threads/dr-wishs-black-green-dot-indicator-for-thinkorswim.8110/
# to include stuff from
# https://wishingwealthblog.com/2018/03/green-dot-strategy-defined/
# https://aaiidcmetro.com/slides/(2019-07-13)wish.pdf
# https://wishingwealthblog.com/glossary/

# -- 30 week avg for Dr Wish, one of the conditions for determining trend.  Stock should be above.
def agg = AggregationPeriod.WEEK;
def ThirtyWeek = close(period = agg);
plot wk30sma = Average(ThirtyWeek, 30);
wk30sma.setDefaultColor(color.light_green);
AddLabel(close > wk30sma, " Above 30wk sma ", color.green);
AddLabel(close < wk30sma, " Below 30wk sma ", color.pink);

# -- Red White and Blue exp avg ribbons
# -- Prefer seeing all red avgs as a ribbon with white chart background space above blue avgs ribbon.
# -- Strong pattern all avgs lined up with each above the next longer avg and the close leading them all higher.
# -- Red ribbons
plot Red3 = ExpAverage(close, 3);
Red3.setDefaultColor(color.pink);
plot Red5 = ExpAverage(close, 5);
Red5.setDefaultColor(color.pink);
plot Red8 = ExpAverage(close, 8);
Red8.setDefaultColor(color.pink);
plot Red10 = ExpAverage(close, 10);
Red10.setDefaultColor(color.pink);
plot Red12 = ExpAverage(close, 12);
Red12.setDefaultColor(color.pink);
plot Red15 = ExpAverage(close, 15);
Red15.setDefaultColor(color.pink);

# -- Blue ribbons
plot Blue30 = ExpAverage(close, 30);
Blue30.setDefaultColor(color.cyan);
plot Blue35 = ExpAverage(close, 35);
Blue35.setDefaultColor(color.cyan);
plot Blue40 = ExpAverage(close, 40);
Blue40.setDefaultColor(color.cyan);
plot Blue45 = ExpAverage(close, 45);
Blue45.setDefaultColor(color.cyan);
plot Blue50 = ExpAverage(close, 50);
Blue50.setDefaultColor(color.cyan);
plot Blue60 = ExpAverage(close, 60);
Blue60.setDefaultColor(color.cyan);

# -- close, prefer above the ribbons.
plot ClosePrice = close;
ClosePrice.setDefaultColor(color.white);
#ClosePrice.SetPaintingStrategy(paintingStrategy.Dashes);
ClosePrice.setLineWeight(2);``````

Only had this running a few days so not thoroughly tested.
What a great contribution. Thank you for sharing this. I had considered trying to do all of this myself after learning about the Dr. Wish system and watching him on YouTube but it would have been difficult for me and the end result likely wouldn't have been quite right.

The only other component from his system that I wanted to work on which is still missing is the green line breakout (the idea of buying at historical all time high after drawing a green line at the previous high that is broken above). Is it possible to code this line to stay intact as the previous all time high which has been broken one time? It's not clear to me how to code a condition like that while allowing the line to be persistent.

### Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
247 Online

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