# Ichimoku Clouds For ThinkOrSwim

#### henry1224

##### Expert
VIP
Ichimoku Clouds For ThinkOrSwim

mod note:
The Ichimoku Cloud is popular in that it displays support and resistance, momentum, and trend all in one view.
TenkanSen and KijunSen are similar to moving averages and are analyzed in relationship to one another.

Code:
``````#
# TD Ameritrade IP Company, Inc. (c) 2007-2024
# Modified by Henry Kaczmarczyk 05142024
input T_Arrows = 0; #1 == yes 0 == no
input K_Arrows = 0; #1 == yes 0 == no
input SA_Arrows = 0; #1 == yes 0 == no
input SB_Arrows = 0; #1 == yes 0 == no
input TKC_Arrows = 0; #1 == yes 0 == no
input SABC_Arrows = 0; #1 == yes 0 == no
input Dotsize = 2; # size of arrows

input tenkan_period = 9;
input kijun_period = 26;
input Plt_Chikou = 0; #1 == yes 0 == no
plot Tenkan = (Highest(high, tenkan_period) + Lowest(low, tenkan_period)) / 2;
plot Kijun = (Highest(high, kijun_period) + Lowest(low, kijun_period)) / 2;
plot "Span A" = (Tenkan[kijun_period] + Kijun[kijun_period]) / 2;
plot "Span B" = (Highest(high[kijun_period], 2 * kijun_period) + Lowest(low[kijun_period], 2 * kijun_period)) / 2;
plot Chikou = if Plt_Chikou == 1 then close[-kijun_period] else Double.Nan;

def TKMx = Max(Tenkan,Kijun);
def TKMn = Min(Tenkan,Kijun);

def SMx = Max("Span A","Span B");
def SMn = Max("Span A","Span B");

Tenkan.SetDefaultColor(Color.Cyan);
Kijun.SetDefaultColor(Color.Magenta);
"Span A".SetDefaultColor(Color.Blue);
"Span B".SetDefaultColor(Color.Red);
Chikou.SetDefaultColor(Color.Gray);

DefineGlobalColor("Bullish", Color.Blue);
DefineGlobalColor("Bearish", Color.RED);
AddCloud("Span A", "Span B", globalColor("Bullish"), globalColor("Bearish"));
DefineGlobalColor("Bullish2", Color.Cyan);
DefineGlobalColor("Bearish2", Color.Magenta);
AddCloud(Tenkan, Kijun, globalColor("Bullish2"), globalColor("Bearish2"));

Plot T_Arrow_up = if T_Arrows==1 and (Close Crosses Above Tenkan) then Low else double.nan;
Plot T_Arrow_dn = if T_Arrows==1 and (Close Crosses below Tenkan) then High else double.nan;
Plot K_Arrow_up = if K_Arrows==1 and (Close Crosses Above Kijun) then Low else double.nan;
Plot K_Arrow_dn = if K_Arrows==1 and (Close Crosses below Kijun) then High else double.nan;
Plot SA_Arrow_up = if SA_Arrows==1 and (Close Crosses Above "Span A") then Low else double.nan;
Plot SA_Arrow_dn = if SA_Arrows==1 and (Close Crosses below "Span A") then High else double.nan;
Plot SB_Arrow_up = if SB_Arrows==1 and (Close Crosses Above "Span B") then Low else double.nan;
Plot SB_Arrow_dn = if SB_Arrows==1 and (Close Crosses below "Span B") then High else double.nan;

Plot TKC_Arrow_up = if TKC_Arrows==1 and (Close Crosses Above TKMx) then Low else double.nan;
Plot TKC_Arrow_dn = if TKC_Arrows==1 and (Close Crosses below TKMn) then High else double.nan;

Plot SABC_Arrow_up = if SABC_Arrows==1 and (Close Crosses Above SMx) then Low else double.nan;
Plot SABC_Arrow_dn = if SABC_Arrows==1 and (Close Crosses below SMn) then High else double.nan;

T_Arrow_Up.setpaintingStrategy(paintingStrategy.Arrow_Up);
T_Arrow_up.setDefaultColor(color.Cyan);
T_Arrow_Up.setLineWeight(dotsize);
T_Arrow_Dn.setpaintingStrategy(paintingStrategy.Arrow_Down);
T_Arrow_Dn.setDefaultColor(color.Cyan);
T_Arrow_Dn.setLineWeight(dotsize);
K_Arrow_Up.setpaintingStrategy(paintingStrategy.Arrow_Up);
K_Arrow_up.setDefaultColor(color.Magenta);
K_Arrow_Up.setLineWeight(dotsize);
K_Arrow_Dn.setpaintingStrategy(paintingStrategy.Arrow_Down);
K_Arrow_Dn.setDefaultColor(color.Magenta);
K_Arrow_Dn.setLineWeight(dotsize);
SA_Arrow_Up.setpaintingStrategy(paintingStrategy.Arrow_Up);
SA_Arrow_up.setDefaultColor(color.Blue);
SA_Arrow_Up.setLineWeight(dotsize);
SA_Arrow_Dn.setpaintingStrategy(paintingStrategy.Arrow_Down);
SA_Arrow_Dn.setDefaultColor(color.Blue);
SA_Arrow_Dn.setLineWeight(dotsize);
SB_Arrow_Up.setpaintingStrategy(paintingStrategy.Arrow_Up);
SB_Arrow_up.setDefaultColor(color.Red);
SB_Arrow_Up.setLineWeight(dotsize);
SB_Arrow_Dn.setpaintingStrategy(paintingStrategy.Arrow_Down);
SB_Arrow_Dn.setDefaultColor(color.Red);
SB_Arrow_Dn.setLineWeight(dotsize);

TKC_Arrow_Up.setpaintingStrategy(paintingStrategy.Arrow_Up);
TKC_Arrow_up.setDefaultColor(color.Yellow);
TKC_Arrow_Up.setLineWeight(dotsize +1);
TKC_Arrow_Dn.setpaintingStrategy(paintingStrategy.Arrow_Down);
TKC_Arrow_Dn.setDefaultColor(color.Yellow);
TKC_Arrow_Dn.setLineWeight(dotsize +1);

SABC_Arrow_Up.setpaintingStrategy(paintingStrategy.Arrow_Up);
SABC_Arrow_up.setDefaultColor(color.Dark_Orange);
SABC_Arrow_Up.setLineWeight(dotsize +1);
SABC_Arrow_Dn.setpaintingStrategy(paintingStrategy.Arrow_Down);
SABC_Arrow_Dn.setDefaultColor(color.Dark_Orange);
SABC_Arrow_Dn.setLineWeight(dotsize +1);``````

Last edited by a moderator:
@henry1224 Perhaps you could go over the modifications from the original TOS version... Giving it a whirl...

@henry1224 Perhaps you could go over the modifications from the original TOS version... Giving it a whirl...
I first added the cloud for the Tenkan / Kijun making it easier to view those lines
I then added the ability to hide the useless Chikou line
then I added the ability for arrows for each line separately or for the clouds separately
using the number 1 for on , or 0 for off

here is an indicator that defines the strength of the Ichimoku Cloud
Code:
``````declare lower;
input Length1 = 9;
input Length2 = 26;
input UB = 8;
input LB = -8;
input Dotsize = 2;
def SMA1 = Close;
def SMA2 = (Highest(high, Length1) + Lowest(low, Length1)) / 2;
def SMA3 = (Highest(high, Length2) + Lowest(low, Length2)) / 2;
def SMA4 = (SMA2[Length2] + SMA3[Length2]) / 2;
def SMA5 = (Highest(high[Length2], 2 * Length2) + Lowest(low[Length2], 2 * Length2)) / 2;

plot P10 = if SMA1 > SMA2 and SMA2 > SMA3 and SMA3 > SMA4 and SMA4 > SMA5 then 10 else 0;
P10.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
P10.SetDefaultColor(CreateColor(0,102,0));
P10.setLineweight(3);
def Con9A = if SMA1 > SMA2 and SMA2 > SMA3 and SMA3 > SMA5 and SMA5 > SMA4 then 9 else 0;
def Con9B = if SMA1 > SMA3 and SMA3 > SMA2 and SMA2 > SMA4 and SMA4 > SMA5 then 9 else 0;
def Con9C = if SMA2 > SMA1 and SMA1 > SMA3 and SMA3 > SMA4 and SMA4 > SMA5  then 9 else 0;
def Con9D = if SMA1 > SMA2 and SMA2 > SMA4 and SMA4 > SMA3 and SMA3 > SMA5 then 9 else 0;
plot P9 = (Con9A + Con9B + Con9C + Con9D);
P9.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
P9.SetDefaultColor(CreateColor(0, 204,0));
P9.setLineweight(3);
def Con8A = if SMA1 > SMA3 and SMA3 > SMA2 and SMA2 > SMA5 and SMA5 > SMA4 then 8 else 0;
def Con8B = if SMA2 > SMA1 and SMA1 > SMA3 and SMA3 > SMA5 and SMA5 > SMA4 then 8 else 0;
def Con8C = if SMA2 > SMA1 and SMA1 > SMA4 and SMA4 > SMA3 and SMA3 > SMA5 then 8 else 0;
plot P8 = (Con8A + Con8B + Con8C);
P8.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
P8.SetDefaultColor(CreateColor(51,255,51));
P8.setLineweight(3);
def Con7A = if SMA1 > SMA2 and SMA2 > SMA5 and SMA5 > SMA3 and SMA3 > SMA4 then 7 else 0;
def Con7B = if SMA2 > SMA3 and SMA3 > SMA1 and SMA1 > SMA4 and SMA4 > SMA5 then 7 else 0;
def Con7C = if SMA3 > SMA1 and SMA1 > SMA2 and SMA2 > SMA4 and SMA4 > SMA5 then 7 else 0;
def Con7D = if SMA1 > SMA2 and SMA2 > SMA4 and SMA4 > SMA5 and SMA5 > SMA3 then 7 else 0;
def Con7E = if SMA1 > SMA3 and SMA3 > SMA4 and SMA4 > SMA2 and SMA2 > SMA5 then 7 else 0;
def Con7F = if SMA1 > SMA4 and SMA4 > SMA2 and SMA2 > SMA3 and SMA3 > SMA5 then 7 else 0;
plot P7 = (Con7A + Con7B + Con7C + Con7D + Con7E + Con7F);
P7.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
P7.SetDefaultColor(CreateColor(0,153,153));
P7.setLineweight(3);
def Con6A = if SMA2 > SMA1 and SMA1 > SMA5 and SMA5 > SMA3 and SMA3 > SMA4 then 6 else 0;
def Con6B = if SMA2 > SMA3 and SMA3 > SMA1 and SMA1 > SMA5 and SMA5 > SMA4 then 6 else 0;
def Con6C = if SMA3 > SMA1 and SMA1 > SMA2 and SMA2 > SMA5 and SMA5 > SMA4 then 6 else 0;
def Con6D = if SMA3 > SMA2 and SMA2 > SMA1 and SMA1 > SMA4 and SMA4 > SMA5 then 6 else 0;
def Con6E = if SMA1 > SMA2 and SMA2 > SMA5 and SMA5 > SMA4 and SMA4 > SMA3 then 6 else 0;
def Con6F = if SMA1 > SMA4 and SMA4 > SMA3 and SMA3 > SMA2 and SMA2 > SMA5 then 6 else 0;
def Con6G = if SMA2 > SMA1 and SMA1 > SMA4 and SMA4 > SMA5 and SMA5 > SMA3 then 6 else 0;
plot P6 = (Con6A + Con6B + Con6C + Con6D + Con6E + Con6F + Con6G);
P6.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
P6.SetDefaultColor(CreateColor(0,255,204));
P6.setLineweight(3);
def Con5A = if SMA1 > SMA3 and SMA3 > SMA5 and SMA5 > SMA2 and SMA2 > SMA4 then 5 else 0;
def Con5B = if SMA3 > SMA2 and SMA2 > SMA1 and SMA1 > SMA5 and SMA5 > SMA4 then 5 else 0;
def Con5C = if SMA2 > SMA1 and SMA1 > SMA5 and SMA5 > SMA4 and SMA4 > SMA3 then 5 else 0;
def Con5D = if SMA3 > SMA1 and SMA1 > SMA4 and SMA4 > SMA2 and SMA2 > SMA5 then 5 else 0;
def Con5E = if SMA1 > SMA4 and SMA4 > SMA2 and SMA2 > SMA5 and SMA5 > SMA3 then 5 else 0;
def Con5F = if SMA2 > SMA4 and SMA4 > SMA1 and SMA1 > SMA3 and SMA3 > SMA5 then 5 else 0;
plot P5 = (Con5A + Con5B + Con5C + Con5D + Con5E + Con5F);
P5.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
P5.SetDefaultColor(CreateColor(102, 255,204));
P5.setLineweight(3);
def Con4A = if SMA1 > SMA5 and SMA5 > SMA2 and SMA2 > SMA3 and SMA3 > SMA4 then 4 else 0;
def Con4B = if SMA1 > SMA3 and SMA3 > SMA4 and SMA4 > SMA5 and SMA5 > SMA2 then 4 else 0;
def Con4C = if SMA2 > SMA3 and SMA3 > SMA4 and SMA4 > SMA1 and SMA1 > SMA5 then 4 else 0;
def Con4D = if SMA4 > SMA1 and SMA1 > SMA2 and SMA2 > SMA3 and SMA3 > SMA5 then 4 else 0;
plot P4 = (Con4A + Con4B + Con4C + Con4D);
P4.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
P4.SetDefaultColor(CreateColor(153,255,204));
P4.setLineweight(3);
def Con3A = if SMA1 > SMA5 and SMA5 > SMA3 and SMA3 > SMA2 and SMA2 > SMA4 then 3 else 0;
def Con3B = if SMA3 > SMA1 and SMA1 > SMA5 and SMA5 > SMA2 and SMA2 > SMA4 then 3 else 0;
def Con3C = if SMA1 > SMA5 and SMA5 > SMA2 and SMA2 > SMA4 and SMA4 > SMA3 then 3 else 0;
def Con3D = if SMA1 > SMA3 and SMA3 > SMA5 and SMA5 > SMA4 and SMA4 > SMA2 then 3 else 0;
def Con3E = if SMA3 > SMA2 and SMA2 > SMA4 and SMA4 > SMA1 and SMA1 > SMA5 then 3 else 0;
def Con3F = if SMA1 > SMA4 and SMA4 > SMA3 and SMA3 > SMA5 and SMA5 > SMA2 then 3 else 0;
def Con3G = if SMA2 > SMA4 and SMA4 > SMA1 and SMA1 > SMA5 and SMA5 > SMA3 then 3 else 0;
def Con3H = if SMA2 > SMA4 and SMA4 > SMA3 and SMA3 > SMA1 and SMA1 > SMA5 then 3 else 0;
def Con3I = if SMA4 > SMA1 and SMA1 > SMA3 and SMA3 > SMA2 and SMA2 > SMA5 then 3 else 0;
def Con3J = if SMA4 > SMA2 and SMA2 > SMA1 and SMA1 > SMA3 and SMA3 > SMA5 then 3 else 0;
plot P3 = (Con3A + Con3B + Con3C + Con3D + Con3E + Con3F + Con3G  + Con3H + Con3I + Con3J);
P3.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
P3.SetDefaultColor(CreateColor(204,255,204));
P3.setLineweight(3);
def Con2A = if SMA2 > SMA5 and SMA5 > SMA1 and SMA1 > SMA3 and SMA3 > SMA4 then 2 else 0;
def Con2B = if SMA2 > SMA3 and SMA3 > SMA5 and SMA5 > SMA1 and SMA1 > SMA4 then 2 else 0;
def Con2C = if SMA3 > SMA1 and SMA1 > SMA4 and SMA4 > SMA5 and SMA5 > SMA2 then 2 else 0;
def Con2D = if SMA1 > SMA4 and SMA4 > SMA5 and SMA5 > SMA2 and SMA2 > SMA3 then 2 else 0;
def Con2E = if SMA3 > SMA4 and SMA4 > SMA1 and SMA1 > SMA2 and SMA2 > SMA5 then 2 else 0;
def Con2F = if SMA4 > SMA1 and SMA1 > SMA2 and SMA2 > SMA5 and SMA5 > SMA3 then 2 else 0;
plot P2 = (Con2A + Con2B + Con2C + Con2D + Con2E + Con2F);
P2.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
P2.SetDefaultColor(CreateColor(204,255,204));
P2.setLineweight(3);
def Con1A = if SMA3 > SMA2 and SMA2 > SMA5 and SMA5 > SMA1 and SMA1 > SMA4 then 1 else 0;
def Con1B = if SMA1 > SMA5 and SMA5 > SMA3 and SMA3 > SMA4 and SMA4 > SMA2 then 1 else 0;
def Con1C = if SMA2 > SMA5 and SMA5 > SMA1 and SMA1 > SMA4 and SMA4 > SMA3 then 1 else 0;
def Con1D = if SMA3 > SMA1 and SMA1 > SMA5 and SMA5 > SMA4 and SMA4 > SMA2 then 1 else 0;
def Con1E = if SMA1 > SMA5 and SMA5 > SMA4 and SMA4 > SMA2 and SMA2 > SMA3 then 1 else 0;
def Con1F = if SMA1 > SMA4 and SMA4 > SMA5 and SMA5 > SMA3 and SMA3 > SMA2 then 1 else 0;
def Con1G = if SMA3 > SMA4 and SMA4 > SMA2 and SMA2 > SMA1 and SMA1 > SMA5 then 1 else 0;
def Con1H = if SMA4 > SMA2 and SMA2 > SMA4 and SMA1 > SMA5 and SMA5 > SMA3 then 1 else 0;
def Con1I = if SMA4 > SMA2 and SMA2 > SMA4 and SMA3 > SMA1 and SMA1 > SMA5 then 1 else 0;
def Con1J = if SMA4 > SMA3 and SMA3 > SMA1 and SMA1 > SMA2 and SMA2 > SMA5 then 1 else 0;
plot P1 = (Con1A + Con1B + Con1C + Con1D + Con1E + Con1F + Con1G  + Con1H + Con1I + Con1J);
P1.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
P1.SetDefaultColor(CreateColor(204,255,102));
P1.setLineweight(3);
def ConM1A = if SMA5 > SMA1 and SMA1 > SMA3 and SMA3 > SMA2 and SMA2 > SMA4 then -1 else 0;
def ConM1B = if SMA5 > SMA2 and SMA2 > SMA1 and SMA1 > SMA3 and SMA3 > SMA4 then -1 else 0;
def ConM1C = if SMA3 > SMA5 and SMA5 > SMA1 and SMA1 > SMA2 and SMA2 > SMA4 then -1 else 0;
def ConM1D = if SMA5 > SMA1 and SMA1 > SMA2 and SMA2 > SMA4 and SMA4 > SMA3 then -1 else 0;
def ConM1E = if SMA2 > SMA3 and SMA3 > SMA5 and SMA5 > SMA4 and SMA4 > SMA1 then -1 else 0;
def ConM1F = if SMA3 > SMA2 and  SMA2 > SMA4 and SMA4 > SMA5 and SMA5 > SMA1 then -1 else 0;
def ConM1G = if SMA2 > SMA4 and SMA4 > SMA5 and SMA5 > SMA1 and SMA1 > SMA3 then -1 else 0;
def ConM1H = if SMA2 > SMA4 and SMA4 > SMA3 and SMA3 > SMA5 and SMA5 > SMA1 then -1 else 0;
def ConM1I = if SMA3 > SMA4 and SMA4 > SMA1 and SMA1 > SMA5 and SMA5 > SMA2 then -1 else 0;
def ConM1J = if SMA4 > SMA1 and SMA1 > SMA5 and SMA5 > SMA2 and SMA2 > SMA3 then -1 else 0;
plot M1 = (ConM1A + ConM1B + ConM1C + ConM1D + ConM1E + ConM1F + ConM1G  + ConM1H + ConM1I + ConM1J);
M1.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
M1.SetDefaultColor(CreateColor(255,204,204));
M1.setLineweight(3);
def ConM2A = if SMA5 > SMA2 and SMA2 > SMA1 and SMA1 > SMA4 and SMA4 > SMA3 then -2 else 0;
def ConM2B = if SMA3 > SMA5 and SMA5 > SMA2 and SMA2 > SMA1 and SMA1 > SMA4 then -2 else 0;
def ConM2C = if SMA3 > SMA2 and SMA2 > SMA5 and SMA5 > SMA4 and SMA4 > SMA1 then -2 else 0;
def ConM2D = if SMA2 > SMA5 and SMA5 > SMA4 and SMA4 > SMA1 and SMA1 > SMA3 then -2 else 0;
def ConM2E = if SMA4 > SMA1 and SMA1 > SMA5 and SMA5 > SMA3 and SMA3 > SMA2 then -2 else 0;
def ConM2F = if SMA4 > SMA3 and SMA3 > SMA1 and SMA1 > SMA5 and SMA5 > SMA2 then -2 else 0;
plot M2 = (ConM2A + ConM2B + ConM2C + ConM2D + ConM2E + ConM2F);
M2.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
M2.SetDefaultColor(CreateColor(255,204,102));
M2.setLineweight(3);
def ConM3A = if SMA5 > SMA2 and SMA2 > SMA3 and SMA3 > SMA1 and SMA1 > SMA4 then -3 else 0;
def ConM3B = if SMA5 > SMA3 and SMA3 > SMA1 and SMA1 > SMA2 and SMA2 > SMA4 then -3 else 0;
def ConM3C = if SMA5 > SMA1 and SMA1 > SMA3 and SMA3 > SMA4 and SMA4 > SMA2 then -3 else 0;
def ConM3D = if SMA2 > SMA5 and SMA5 > SMA3 and SMA3 > SMA4 and SMA4 > SMA1 then -3 else 0;
def ConM3E = if SMA3 > SMA5 and SMA5 > SMA1 and SMA1 > SMA4 and SMA4 > SMA2 then -3 else 0;
def ConM3F = if SMA5 > SMA1 and SMA1 > SMA4 and SMA4 > SMA2 and SMA2 > SMA3 then -3 else 0;
def ConM3G = if SMA2 > SMA4 and SMA4 > SMA5 and SMA5 > SMA3 and SMA3 > SMA1 then -3 else 0;
def ConM3H = if SMA3 > SMA4 and SMA4 > SMA2 and SMA2 > SMA5 and SMA5 > SMA1 then -3 else 0;
def ConM3I = if SMA4 > SMA2 and SMA2 > SMA5 and SMA5 > SMA1 and SMA1 > SMA3 then -3 else 0;
def ConM3J = if SMA4 > SMA2 and SMA2 > SMA3 and SMA3 > SMA5 and SMA5 > SMA1 then -3 else 0;
plot M3 = (ConM3A + ConM3B + ConM3C + ConM3D + ConM3E + ConM3F + ConM3G  + ConM3H + ConM3I + ConM3J);
M3.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
M3.SetDefaultColor(CreateColor(255,153,51));
M3.setLineweight(3);
def ConM4A = if SMA5 > SMA3 and SMA3 > SMA2 and SMA2 > SMA1 and SMA1 > SMA4 then -4 else 0;
def ConM4B = if SMA5 > SMA1 and SMA1 > SMA4 and SMA4 > SMA3 and SMA3 > SMA2 then -4 else 0;
def ConM4C = if SMA2 > SMA5 and SMA5 > SMA4 and SMA4 > SMA3 and SMA3 > SMA1 then -4 else 0;
def ConM4D = if  SMA4 > SMA3 and SMA3 > SMA2 and SMA2 > SMA5 and SMA5 > SMA1 then -4 else 0;
plot M4 = (ConM4A + ConM4B + ConM4C + ConM4D);
M4.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
M4.SetDefaultColor(CreateColor(204,51,0));
M4.setLineweight(3);
def ConM5A = if SMA5 > SMA3 and SMA3 > SMA1 and SMA1 > SMA4 and SMA4 > SMA2 then -5 else 0;
def ConM5B = if SMA3 > SMA5 and SMA5 > SMA2 and SMA2 > SMA4 and SMA4 > SMA1 then -5 else 0;
def ConM5C = if SMA5 > SMA2 and SMA2 > SMA4 and SMA4 > SMA1 and SMA1 > SMA3 then -5 else 0;
def ConM5D = if SMA3 > SMA4 and SMA4 > SMA5 and SMA5 > SMA1 and SMA1 > SMA2 then -5 else 0;
def ConM5E = if SMA4 > SMA5 and SMA5 > SMA1 and SMA1 > SMA2 and SMA2 > SMA3 then -5 else 0;
def ConM5F = if SMA4 > SMA2 and SMA2 > SMA5 and SMA5 > SMA3 and SMA3 > SMA1 then -5 else 0;
plot M5 = (ConM5A + ConM5B + ConM5C + ConM5D + ConM5E + ConM5F);
M5.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
M5.SetDefaultColor(CreateColor(255, 102, 102));
M5.setLineweight(3);
def ConM6A = if SMA5 > SMA2 and SMA2 > SMA3 and SMA3 > SMA4 and SMA4 > SMA1 then -6 else 0;
def ConM6B = if SMA3 > SMA5 and SMA5 > SMA4 and SMA4 > SMA1 and SMA1 > SMA2 then -6 else 0;
def ConM6C = if SMA3 > SMA4 and SMA4 > SMA5 and SMA5 > SMA2 and SMA2 > SMA1 then -6 else 0;
def ConM6D = if SMA5 > SMA4 and SMA4 > SMA1 and SMA1 > SMA2 and SMA2 > SMA3 then -6 else 0;
def ConM6E = if SMA4 > SMA5 and SMA5 > SMA1 and SMA1 > SMA3 and SMA3 > SMA2 then -6 else 0;
def ConM6F = if SMA4 > SMA3 and SMA3 > SMA5 and SMA5 > SMA1 and SMA1 > SMA2 then -6 else 0;
plot M6 = (ConM6A + ConM6B + ConM6C + ConM6D + ConM6E + ConM6F);
M6.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
M6.SetDefaultColor(CreateColor(255,51,102));
M6.setLineweight(3);
def ConM7A = if SMA5 > SMA3 and SMA3 > SMA2 and SMA2 > SMA4 and SMA4 > SMA1 then -7 else 0;
def ConM7B = if SMA5 > SMA2 and SMA2 > SMA4 and SMA4 > SMA3 and SMA3 > SMA1 then -7 else 0;
def ConM7C = if SMA3 > SMA5 and SMA5 > SMA4 and SMA4 > SMA2 and SMA2 > SMA1 then -7 else 0;
def ConM7D = if SMA5 > SMA4 and SMA4 > SMA1 and SMA1 > SMA3 and SMA3 > SMA2 then -7 else 0;
def ConM7E = if SMA5 > SMA4 and SMA4 > SMA2 and SMA2 > SMA1 and SMA1 > SMA3 then -7 else 0;
def ConM7F = if SMA4 > SMA3 and SMA3 > SMA5 and SMA5 > SMA2 and SMA2 > SMA1 then -7 else 0;
plot M7 = (ConM7A + ConM7B + ConM7C + ConM7D + ConM7E + ConM7F);
M7.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
M7.SetDefaultColor(CreateColor(204,0,102));
M7.setLineweight(3);
def ConM8A = if SMA5 > SMA3 and SMA3 > SMA4 and SMA4 > SMA1 and SMA1 > SMA2 then -8 else 0;
def ConM8B = if SMA4 > SMA5 and SMA5 > SMA2 and SMA2 > SMA3 and SMA3 > SMA1 then -8 else 0;
def ConM8C = if SMA4 > SMA5 and SMA5 > SMA3 and SMA3 > SMA1 and SMA1 > SMA2 then -8 else 0;
plot M8 = (ConM8A + ConM8B + ConM8C);
M8.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
M8.SetDefaultColor(CreateColor(255,0,255));
M8.setLineweight(3);
def ConM9A = if SMA5 > SMA3 and SMA3 > SMA4 and SMA4 > SMA2 and SMA2 > SMA1 then -9 else 0;
def ConM9B = if SMA5 > SMA4 and SMA4 > SMA2 and SMA2 > SMA3 and SMA3 > SMA1 then -9 else 0;
def ConM9C = if SMA5 > SMA4 and SMA4 > SMA3 and SMA3 > SMA1 and SMA1 > SMA2 then -9 else 0;
def ConM9D = if SMA4 > SMA5 and SMA5 > SMA3 and SMA3 > SMA2 and SMA2 > SMA1 then -9 else 0;
plot M9 = (ConM9A + ConM9B + ConM9C + ConM9D);
M9.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
M9.SetDefaultColor(CreateColor(153,0,204));
M9.setLineweight(3);
plot M10 = if SMA5 > SMA4 and SMA4 > SMA3 and SMA3 > SMA2 and SMA2 > SMA1 then -10 else 0;
M10.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
M10.SetDefaultColor(CreateColor(102,0,102));
M10.setLineweight(3);

Plot Total = (P10 + P9 + P8 + P7 + P6 + P5 + P4 + P3 + P2 + P1 + M10 + M9 + M8 + M7 + M6 + M5 + M4 + M3 + M2 + M1);
Total.SetDefaultColor(CreateColor(204,204,0));
Total.SetLineWeight(2);
Plot ZeroLine =0;
ZeroLine.SetDefaultColor(Color.Dark_Gray);

Plot AU_Dot = if Total Crosses Above 0 then 0 else Double.Nan;
Plot AD_Dot = if Total Crosses Below 0 then 0 else Double.Nan;
AU_Dot.SetdefaultColor(Color.Yellow);
AU_Dot.SetPaintingStrategy(PaintingStrategy.POINTS);
AU_Dot.SetLineWeight(Dotsize);

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

Start a new thread and receive assistance from our community.

87k+ Posts
311 Online

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• 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?