Tea 2.0 - Market Cycle Indicator For ThinkOrSwim

farresa

New member
VIP
There are generally 4 phases to a full market cycle, at least the way I was taught. Accumulation Phase, Mark up(Acceleration) Phase, Distribution Phase, and Mark down(de-acceleration) Phase. I recently came across an indicator that does a pretty good job of identifying the phases of a market but I need it altered for how I want to use it and don't have the knowledge or skills to do it myself. Here is the code for those who may want to use it as well as alter it.

Code:
# TEA 2.0 - TOS version - 2015-06-04
# From Andrew Falde's work - LessThanRandom.com
# Converted from TradeStation to TOS by John Chernicky

#Hint: TEA 2.0 by Andrew Falde at LessThanRandom.com

declare lower;
input Period = 21; # Bars for Price Analysis
#Hint Period: Period in number of bars.
def Price = close; # Use closing price for calculaltion
input Author = "Andrew Falde - LessThanRandom.com";

# Expansion Calculation
def ATR = reference ATR(Period, averageType = AverageType.SIMPLE);
def StdDev = StDev(data = Price, length = Period);
def squeeze = (ATR * .75) - StdDev;
def Expansion = If (squeeze < 0, 1, 0);

# Linear Regression
def lowest = Lowest(low[1], Period);
def highest = Highest(high[1], Period);
def EMA = ExpAverage(Price, Period);
def Resolve = Price - ((highest + lowest) / 2 + EMA) / 2;
def Trendline = LinearRegCurve(0, Period, Resolve);

# Trend Calculation
# 1 - Accumulation
# 2 - Mark Up
# 3 - Distribution
# 4 - Mark Down
# 0 - No Trend
def Trend = if Trendline <= 0 and Trendline > Trendline[1] then 1 else (
            if Trendline > 0 and Trendline > Trendline[1] then 2 else (
            if Trendline > 0 and Trendline < Trendline[1] then 3 else (
            if Trendline <= 0 and Trendline < Trendline[1] then 4 else (
            Double.NaN))));

plot TEA =
(if Trend == 1 then -1
else (if Trend == 2 then 1
else (if Trend == 3 then 1
else (if Trend == 4 then -1 else Double.NaN
))));

plot Consolidated = (if Expansion == 0 then 0 else Double.NaN);

TEA.AssignValueColor
(if Trend == 1 then Color.DARK_RED
else (if Trend == 2 then Color.GREEN
else (if Trend == 3 then Color.DARK_GREEN
else (if Trend == 4 then Color.RED else Color.DARK_GRAY
))));

TEA.SetPaintingStrategy(PaintingStrategy.POINTS);
TEA.SetLineWeight(4);
#TEA.HideTitle();
TEA.HideBubble();

Consolidated.AssignValueColor(Color.BLUE);
Consolidated.SetPaintingStrategy(PaintingStrategy.POINTS);
Consolidated.SetLineWeight(4);
#Consolidated.HideTitle();
Consolidated.HideBubble();

I found it at https://www.smbtraining.com/blog/tea-2-0-indicator

This script terms it trend calculations! It is a lower study which is a pain at least for me. I would like to see the points(dots) for phases 1 accumulation and markup be under the price bars offset a little bit and the distribution and markdown phases be points(dots) above the price bars offset a little bit. The consolidation I don't need so I could comment that out. I can also change the colors in the code so that is no problem but I have tried for 2 days to alter this code and I have always come right back to square one. If anyone will help it is much appreciated.
 
Last edited by a moderator:
Interesting indicator, thanks for posting. I do not have a dot plotting solution on the main chart for you at the moment. But I do have a temporary solution so you do not have to keep referencing a lower panel.

Labels on the main chart if interested. Reference out the declare lower line and add in at the end of the code. Uncheck the show plots for TEA and Consolidated from setup. As you said you are comfortable changing the colors about. I changed the dark red on Accumulation to orange for my easy at a glance color separation.

Code:
AddLabel(yes, if Trend == 1 then "Accumulation" else "", Color.Orange);
AddLabel(yes, if Trend == 2 then "Mark Up" else "", Color.Green);
AddLabel(yes, if Trend == 3 then "Distribution" else "", Color.Dark_Green);
AddLabel(yes, if Trend == 4 then "Market Down" else "", Color.Red);
AddLabel(yes, if Expansion == 0 then "Volatility Consolidation" else "", Color.Blue);

Added:

I found you can use Boolean_Arrow_Up or Boolean_Wedge_Up in addition to arrow / wedge_down to plot on the main chart above / below the price bar. Using a Boolean Point places a point on the close of the bar which does not sound like what you are after. Still need to remark out the declare lower.

Something like:

Code:
plot Accum = Trend == 1;
Accum.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Accum.AssignValueColor(Color.Orange);

Not ideal, but the best I have to offer at the moment. Maybe someone else chime in with a better solution.
 
Last edited by a moderator:
@young_and_dumb Here is the share link from smb site that this came from. http://tos.mx/DUZDmM This will be the same as what I copied and posted above unless I missed something in that process. I am not a coder so what I download is what works for me. I spent 2 days trying to hack at this and cobble something together but could get nothing to work. Therefore I had to request some help. Thank you for what your trying to do! Much appreciated!!!!

@RickAns Thanks for your efforts I will try and see if I can get the arrow/wedge up and down to work for me. Much appreciated !!!
 
Here is TEA combined with Trend ADvisor Diamond Phase. If you set the APC input to 1, you will paint the bars for the Trend Advisor, set the APC input to 2 you will paint the bars to the TEA Indicator. The Trend Advisor are in Histogram, TEA are set as points.

Code:
Declare Lower;
Input Length1 = 50;
Input Length2 = 200;
input Period = 21; # Bars for Price Analysis TEA
Input APC = 0;
Def Price= Close;
Def ML1=Average(Price,Length1);
Def ML2=Average(Price,Length2);
Plot RecP = If (ML1 < ML2 AND Price < ML2 AND Price > ML1) then 1 else 0;
Plot WarnP = If(ML1 > ML2 AND Price > ML2 AND Price < ML1) then -1 Else 0;
Plot AcumP = If(ML1 < ML2 AND Price > ML2 AND Price > ML1) Then 2 Else 0;
Plot DispP = If(ML1 > ML2 AND Price < ML2 AND Price < ML1) then -2 else 0;
Plot BullP = If(ML1 > ML2 AND Price > ML2 AND Price > ML1) then 3 else 0;
Plot BearP = If(ML1 < ML2 AND Price < ML2 AND Price < ML1)then -3 else 0;
RecP.SetPaintingStrategy(PaintingStrategy.Histogram);
RecP.SetDefaultColor(Color.Light_Green);
WarnP.SetPaintingStrategy(PaintingStrategy.Histogram);
WarnP.SetDefaultColor(Color.Orange);
AcumP.SetPaintingStrategy(PaintingStrategy.Histogram);
AcumP.SetDefaultColor(Color. Green);
DispP.SetPaintingStrategy(PaintingStrategy.Histogram);
DispP.SetDefaultColor(Color.Red);
BullP.SetPaintingStrategy(PaintingStrategy.Histogram);
BullP.SetDefaultColor(Color.Dark_Green);
BearP.SetPaintingStrategy(PaintingStrategy.Histogram);
BearP.SetDefaultColor(Color.Dark_Red);
Plot Zeroline=0;
ZeroLine.SetDefaultColor(GetColor(7));
# Expansion Calculation
def ATR = reference ATR(Period, averageType = AverageType.SIMPLE);
def StdDev = StDev(data = Price, length = Period);
def squeeze = (ATR * .75) - StdDev;
def Expansion = If (squeeze < 0, 1, 0);

# Linear Regression
def lowest = Lowest(low[1], Period);
def highest = Highest(high[1], Period);
def EMA = ExpAverage(Price, Period);
def Resolve = Price - ((highest + lowest) / 2 + EMA) / 2;
def Trendline = LinearRegCurve(0, Period, Resolve);

# Trend Caclulation
# 1 - Accumulation
# 2 - Mark Up
# 3 - Distribution
# 4 - Mark Down
# 0 - No Trend
def Trend = if Trendline <= 0 and Trendline > Trendline[1] then 1 else (
            if Trendline > 0 and Trendline > Trendline[1] then 2 else (
            if Trendline > 0 and Trendline < Trendline[1] then 3 else (
            if Trendline <= 0 and Trendline < Trendline[1] then 4 else (
            Double.NaN))));

plot TEA =
(if Trend == 1 then -4
else (if Trend == 2 then 4
else (if Trend == 3 then 4
else (if Trend == 4 then -4 else Double.NaN
))));

plot Consolidated = (if Expansion == 0 then 0 else Double.NaN);

TEA.AssignValueColor
(if Trend == 1 then Color.DARK_RED
else (if Trend == 2 then Color.GREEN
else (if Trend == 3 then Color.DARK_GREEN
else (if Trend == 4 then Color.RED else Color.DARK_GRAY
))));

TEA.SetPaintingStrategy(PaintingStrategy.POINTS);
TEA.SetLineWeight(4);
#TEA.HideTitle();
TEA.HideBubble();

Consolidated.AssignValueColor(Color.BLUE);
Consolidated.SetPaintingStrategy(PaintingStrategy.POINTS);
Consolidated.SetLineWeight(4);
#Consolidated.HideTitle();
Consolidated.HideBubble();
#AddLabel(yes, "LessThanRandom.com", Color.GRAY);
AssignPriceColor( if APC == 1 and RecP == 1 then Color.Light_Green else if APC == 1 and WarnP == -1 then Color.Orange else if APC == 1 and AcumP == 2 then Color.Green else if APC == 1 and DispP == -2 then Color.Red else if APC ==1 and BullP ==3 then Color.Dark_Green else if  apc == 1 and BearP == -3 then Color.DarK_Red  Else if APC ==2 and Trend == 1 then Color.Dark_Red else if APC == 2 and Trend == 2 then color.Green else if APC==2 and Trend == 3 then Color.Dark_Green else if APC ==2 and Trend ==4 then Color.Red else Color.Current);
 
@henry1224 I was thinking that there might be something more that needed to be added to better qualify the plots for the TEA. This might be it, looking forward to seeing it on a chart. Thank you!!

@cabe1332 I will put this on a chart this evening as well. Got some work to do! Thank you, much appreciated!!!

Going to be a busy evening!!!
 
@henry1224 I was thinking that there might be something more that needed to be added to better qualify the plots for the TEA. This might be it, looking forward to seeing it on a chart. Thank you!!

@cabe1332 I will put this on a chart this evening as well. Got some work to do! Thank you, much appreciated!!!

Going to be a busy evening!!!
TEA & Trend Advisor both show Market Phases. Trend Advisor uses the Close, 50 SMA & 200 SMA to determine which phase we are in. Tea shows contraction "Blue Dots" along the zero line.

I added the 2 indicators together and spaced the TEA lines. I then added the ability to paint the bars.
 
Try this

Code:
#From the book New Trading Dimensions by Bill Willams, PhD
#Coded by Henry Z Kaczmarczyk 01/2021
#Added Multiple Time Frame
# TEA 2.0 - TOS version - 2015-06-04
# From Andrew Falde's work - LessThanRandom.com
# Converted from TradeStation to TOS by John Chernicky
#Hint: TEA 2.0 by Andrew Falde at LessThanRandom.com
#Trend Advisor Diamond Phase by Chuck Dukas , Coded by Henry Z Kaczmarczyk
#Trend Advisor Line 1 is current Time Frame. Line 2 is next higher Time Frame. Line 3 is second higher time frame.
#Trend Advisor is shown as Squares Compares Close to the 50 & 200 SMA
#Recovery Phase is Light Green
#Warning Phase is Orange
#Accumulation Phase is Green
#Dispersition Phase is Red
#Bullish Phase is Dark_Green
#Bearish Phase is Dark_Red
#TEA v 2.0 are shown as Points on lines 0,5 TEAB First Higher Time frame Lines 6, TEAC second higher Time frame Lines 7
#Consolidation is shown as Blue Points on the zero line
# Trend Caclulation
# 1 - Accumulation color Dark_Red
# 2 - Mark Up Color Green
# 3 - Distribution Color Dark_Green
# 4 - Mark Down Color Red
# 0 - No Trend
# Bill Williams Zone Bars are shown as Triangles in 3 Different Time Frames
#Green Triangles show when the Awesome Oscillator & AccelerationBands Osc are Bullish
#Red Triangles show when the Awesome Oscillator & AccelerationBands Osc are Bearish
#Blue Triangles show when the Awesome Oscillator & AccelerationBands Osc are Neutral
#Line 9 is then current Time Frame, Line 10 is then next higher time frame, Line 11 is the second higher Time Frame
#SquatBars are shown as Squares on Lines 13,14,15. Line 10 is the currentRatio Time Frame, Line 13 is the next Higher Time Frame, Line 14 is the secondsFromTime Higher Time Frame.
#GreenBars are green and are Bullish
#Squat Bars are Blue and show trend reversal at the end of Trends
#Fade Bars are Red and are Bearish
#FakeBars are Orange
#APC = 1 thru 3 will paint bars for Trend Advisor
#APC = 5 thru 7 will paint bars for TEA v2.0
#APC = 9 thru 11 will paint bars for Zone Bars
#APC = 13 thru 15 will Paint Bars for Squat Bars
Declare Lower;
DefineGlobalColor("GreenZone",Color.Green);
DefineGlobalColor("RedZone",Color.Red);
DefineGlobalColor("Neutral",Color.Blue);
DefineGlobalColor("Greenbar", Color.Green);
DefineGlobalColor("Squatbar", Color.Blue);
DefineGlobalColor("Fadebar", Color.Red);
DefineGlobalColor("Fakebar", Color.Orange);
DefineGlobalColor("Zero", Color.Gray);
input agg1 = AggregationPeriod.FIVE_MIN;
input agg2 = AggregationPeriod.THIRTY_MIN;
input agg3 = AggregationPeriod.HOUR;
Input apc = 5;
Input DotSize = 3;
Input Length1 = 50;
Input Length2 = 200;
input Period = 21; # Bars for Price Analysis TEA
Def Price1 = HL2(Period = agg1);
Def Price2 = HL2(Period = agg2);
Def Price3 = HL2(Period = agg3);
Def Vol1 = Volume(Period = agg1);
Def Vol2 = Volume(Period = agg2);
Def Vol3 = Volume(Period = agg3);
Def H1 = High(Period = agg1);
Def H2 = High(Period = agg2);
Def H3 = High(Period = agg3);
Def L1 = Low(Period = agg1);
Def L2 = Low(Period = agg2);
Def L3 = Low(Period = agg3);
Def C1 = Close(Period = agg1);
Def C2 = Close(Period = agg2);
Def C3 = Close(Period = agg3);

Def ML1=Average(C1,Length1);
Def ML2=Average(C1,Length2);
Def BML1=Average(C2,Length1);
Def BML2=Average(C2,Length2);
Def CML1=Average(C3,Length1);
Def CML2=Average(C3,Length2);
Plot RecP = If (ML1 < ML2 AND C1 < ML2 AND C1 > ML1) then 1 else Double.Nan;
Plot WarnP = If(ML1 > ML2 AND C1 > ML2 AND C1 < ML1) then 1 Else Double.Nan;
Plot AcumP = If(ML1 < ML2 AND C1 > ML2 AND C1 > ML1) Then 1 Else Double.Nan;
Plot DispP = If(ML1 > ML2 AND C1 < ML2 AND C1 < ML1) then 1 else Double.Nan;
Plot BullP = If(ML1 > ML2 AND C1 > ML2 AND C1 > ML1) then 1 else Double.Nan;
Plot BearP = If(ML1 < ML2 AND C1 < ML2 AND C1 < ML1) then 1 else Double.Nan;
RecP.SetPaintingStrategy(PaintingStrategy.Squares);
RecP.SetDefaultColor(Color.Light_Green);
RecP.SetLineWeight(DotSize);
WarnP.SetPaintingStrategy(PaintingStrategy.Squares);
WarnP.SetDefaultColor(Color.Orange);
WarnP.SetLineWeight(DotSize);
AcumP.SetPaintingStrategy(PaintingStrategy.Squares);
AcumP.SetDefaultColor(Color. Green);
AcumP.SetLineWeight(DotSize);
DispP.SetPaintingStrategy(PaintingStrategy.Squares);
DispP.SetDefaultColor(Color.Red);
DispP.SetLineWeight(DotSize);
BullP.SetPaintingStrategy(PaintingStrategy.Squares);
BullP.SetDefaultColor(Color.Dark_Green);
BullP.SetLineWeight(DotSize);
BearP.SetPaintingStrategy(PaintingStrategy.Squares);
BearP.SetDefaultColor(Color.Dark_Red);
BearP.SetLineWeight(DotSize);

Plot RecPB = If (BML1 < BML2 AND C2 < BML2 AND C2 > BML1) then 2 else Double.Nan;
Plot WarnPB = If(BML1 > BML2 AND C2 > BML2 AND C2 < BML1) then 2 Else Double.Nan;
Plot AcumPB = If(BML1 < BML2 AND C2 > BML2 AND C2 > BML1) Then 2 Else Double.Nan;
Plot DispPB = If(BML1 > BML2 AND C2 < BML2 AND C2 < BML1) then 2 else Double.Nan;
Plot BullPB = If(BML1 > BML2 AND C2 > BML2 AND C2 > BML1) then 2 else Double.Nan;
Plot BearPB = If(BML1 < BML2 AND C2 < BML2 AND C2 < BML1) then 2 else Double.Nan;
RecPB.SetPaintingStrategy(PaintingStrategy.Squares);
RecPB.SetDefaultColor(Color.Light_Green);
RecPB.SetLineWeight(DotSize);
WarnPB.SetPaintingStrategy(PaintingStrategy.Squares);
WarnPB.SetDefaultColor(Color.Orange);
WarnPB.SetLineWeight(DotSize);
AcumPB.SetPaintingStrategy(PaintingStrategy.Squares);
AcumPB.SetDefaultColor(Color. Green);
AcumPB.SetLineWeight(DotSize);
DispPB.SetPaintingStrategy(PaintingStrategy.Squares);
DispPB.SetDefaultColor(Color.Red);
DispPB.SetLineWeight(DotSize);
BullPB.SetPaintingStrategy(PaintingStrategy.Squares);
BullPB.SetDefaultColor(Color.Dark_Green);
BullPB.SetLineWeight(DotSize);
BearPB.SetPaintingStrategy(PaintingStrategy.Squares);
BearPB.SetDefaultColor(Color.Dark_Red);
BearPb.SetLineWeight(DotSize);

Plot RecPC = If (CML1 < CML2 AND C3 < CML2 AND C3 > CML1) then 3 else Double.Nan;
Plot WarnPC = If(CML1 > CML2 AND C3 > BML2 AND C3 < CML1) then 3 Else Double.Nan;
Plot AcumPC = If(CML1 < CML2 AND C3 > BML2 AND C3 > CML1) Then 3 Else Double.Nan;
Plot DispPC = If(CML1 > CML2 AND C3 < BML2 AND C3 < CML1) then 3 else Double.Nan;
Plot BullPC = If(CML1 > CML2 AND C3 > BML2 AND C3 > CML1) then 3 else Double.Nan;
Plot BearPC = If(CML1 < CML2 AND C3 < BML2 AND C3 < CML1) then 3 else Double.Nan;
RecPC.SetPaintingStrategy(PaintingStrategy.Squares);
RecPC.SetDefaultColor(Color.Light_Green);
RecPC.SetLineWeight(DotSize);
WarnPC.SetPaintingStrategy(PaintingStrategy.Squares);
WarnPC.SetDefaultColor(Color.Orange);
WarnPC.SetLineWeight(DotSize);
AcumPC.SetPaintingStrategy(PaintingStrategy.Squares);
AcumPC.SetDefaultColor(Color. Green);
AcumPc.SetLineWeight(DotSize);
DispPC.SetPaintingStrategy(PaintingStrategy.Squares);
DispPC.SetDefaultColor(Color.Red);
DispPC.SetLineWeight(DotSize);
BullPC.SetPaintingStrategy(PaintingStrategy.Squares);
BullPC.SetDefaultColor(Color.Dark_Green);
BullPC.SetLineWeight(DotSize);
BearPC.SetPaintingStrategy(PaintingStrategy.Squares);
BearPC.SetDefaultColor(Color.Dark_Red);
BearPC.SetLineWeight(DotSize);
Plot Zeroline=0;
ZeroLine.SetDefaultColor(GetColor(7));
# Expansion Calculation
def ATR = reference ATR(Period, averageType = AverageType.SIMPLE);
def StdDev = StDev(data = Close, length = Period);
def squeeze = (ATR * .75) - StdDev;
def Expansion = If (squeeze < 0, 1, 0);

# Linear Regression

def lowest = Lowest(L1[1], Period);
def lowestB = Lowest(L2[1], Period);
def lowestC = Lowest(L3[1], Period);
def highest = Highest(H1[1], Period);
def highestB = Highest(H2[1], Period);
def highestC = Highest(H3[1], Period);
def EMA = ExpAverage(C1, Period);
def EMAB = ExpAverage(C2, Period);
def EMAC = ExpAverage(C3, Period);
def Resolve = C1 - ((highest + lowest) / 2 + EMA) / 2;
def ResolveB = C2 - ((highestB + lowestB) / 2 + EMAB) / 2;
def ResolveC = C3 - ((highestC + lowestC) / 2 + EMAC) / 2;
def Trendline = LinearRegCurve(0, Period, Resolve);
def TrendlineB = LinearRegCurve(0, Period, ResolveB);
def TrendlineC = LinearRegCurve(0, Period, ResolveC);

# Trend Caclulation
# 1 - Accumulation
# 2 - Mark Up
# 3 - Distribution
# 4 - Mark Down
# 0 - No Trend
def Trend = if Trendline <= 0 and Trendline > Trendline[1] then 1 else (
            if Trendline > 0 and Trendline > Trendline[1] then 2 else (
            if Trendline > 0 and Trendline < Trendline[1] then 3 else (
            if Trendline <= 0 and Trendline < Trendline[1] then 4 else (
            Double.NaN))));
def TrendB = if TrendlineB <= 0 and TrendlineB > TrendlineB[1] then 1 else (
            if TrendlineB > 0 and TrendlineB > TrendlineB[1] then 2 else (
            if TrendlineB > 0 and TrendlineB < TrendlineB[1] then 3 else (
            if TrendlineB <= 0 and TrendlineB < TrendlineB[1] then 4 else (
            Double.NaN))));
def TrendC = if TrendlineC <= 0 and TrendlineC > TrendlineC[1] then 1 else (
            if TrendlineC > 0 and TrendlineC > TrendlineC[1] then 2 else (
            if TrendlineC > 0 and TrendlineC < TrendlineC[1] then 3 else (
            if TrendlineC <= 0 and TrendlineC < TrendlineC[1] then 4 else (
            Double.NaN))));

plot TEA =
(if Trend == 1 then 5
else (if Trend == 2 then 5
else (if Trend == 3 then 5
else (if Trend == 4 then 5 else Double.NaN
))));

plot TEAB =
(if TrendB == 1 then 6
else (if TrendB == 2 then 6
else (if TrendB == 3 then 6
else (if TrendB == 4 then 6 else Double.NaN
))));

plot TEAC =
(if TrendC == 1 then 7
else (if TrendC == 2 then 7
else (if TrendC == 3 then 7
else (if TrendC == 4 then 7 else Double.NaN
))));

plot Consolidated = (if Expansion == 0 then 0 else Double.NaN);

TEA.AssignValueColor
(if Trend == 1 then Color.DARK_RED
else (if Trend == 2 then Color.GREEN
else (if Trend == 3 then Color.DARK_GREEN
else (if Trend == 4 then Color.RED else Color.DARK_GRAY
))));

TEA.SetPaintingStrategy(PaintingStrategy.POINTS);
TEA.SetLineWeight(4);
#TEA.HideTitle();
TEA.HideBubble();

TEAB.AssignValueColor
(if TrendB == 1 then Color.DARK_RED
else (if TrendB == 2 then Color.GREEN
else (if TrendB == 3 then Color.DARK_GREEN
else (if TrendB == 4 then Color.RED else Color.DARK_GRAY
))));

TEAB.SetPaintingStrategy(PaintingStrategy.POINTS);
TEAB.SetLineWeight(4);
#TEAB.HideTitle();
TEAB.HideBubble();

TEAC.AssignValueColor
(if TrendC == 1 then Color.DARK_RED
else (if TrendC == 2 then Color.GREEN
else (if TrendC == 3 then Color.DARK_GREEN
else (if TrendC == 4 then Color.RED else Color.DARK_GRAY
))));

TEAC.SetPaintingStrategy(PaintingStrategy.POINTS);
TEAC.SetLineWeight(4);
#TEAC.HideTitle();
TEAC.HideBubble();

Consolidated.AssignValueColor(Color.BLUE);
Consolidated.SetPaintingStrategy(PaintingStrategy.POINTS);
Consolidated.SetLineWeight(4);
#Consolidated.HideTitle();
Consolidated.HideBubble();
#AddLabel(yes, "LessThanRandom.com", Color.GRAY);

def AO1 = Average(Price1,5) - Average(Price1,34);
def AO2 = Average(Price2,5) - Average(Price2,34);
def AO3 = Average(Price3,5) - Average(Price3,34);
def AC1 = AO1 - Average(AO1,5);
def AC2 = AO2 - Average(AO2,5);
def AC3 = AO3 - Average(AO3,5);
def GZone1 = if AO1 > AO1[1] and AC1 > AC1[1] then 1 else 0;
def RZone1 = if AO1 < AO1[1] and AC1 < AC1[1] then 1 else 0;
def GZone2 = if AO2 > AO2[1] and AC2 > AC2[1] then 1 else 0;
def RZone2 = if AO2 < AO2[1] and AC2 < AC2[1] then 1 else 0;
def GZone3 = if AO3 > AO3[1] and AC3 > AC3[1] then 1 else 0;
def RZone3 = if AO3 < AO3[1] and AC3 < AC3[1] then 1 else 0;
def mfiA = if Vol1 > 0 then (H1 – L1) / Vol1 * 100 else 0;
def mfiB = if Vol2 > 0 then (H2 – L2) / Vol2 * 100 else 0;
def mfiC = if Vol3 > 0 then (H3 – L3) / Vol3 * 100 else 0;
def Con1A = if Vol1[1] > Vol1[2] then 1 else 0;
def Con2A = if mfiA[1] > mfiA[2] then 1 else 0;
def Con1B = if Vol2[1] > Vol2[2] then 1 else 0;
def Con2B = if mfiB[1] > mfiB[2] then 1 else 0;
def Con1C = if Vol3[1] > Vol3[2] then 1 else 0;
def Con2C = if mfiC[1] > mfiC[2] then 1 else 0;
def BW1a= if Con1A == 1 and Con2A == 1 then 1 else 0;
def BW2a= if Con1A == 1 and Con2A == 0 then 2 else 0;
def BW3a= if Con1A == 0 and Con2A == 0 then 3 else 0;
def BW4a= if Con1A == 0 and Con2A == 1 then 4 else 0;
def SBa = (BW1a + BW2a + BW3a + BW4a);
def BW1b= if Con1B == 1 and Con2B == 1 then 1 else 0;
def BW2b= if Con1B == 1 and Con2B == 0 then 2 else 0;
def BW3b= if Con1B == 0 and Con2B == 0 then 3 else 0;
def BW4b= if Con1B == 0 and Con2B == 1 then 4 else 0;
def SBb = (BW1b + BW2b + BW3b + BW4b);
def BW1c= if Con1C == 1 and Con2C == 1 then 1 else 0;
def BW2c= if Con1C == 1 and Con2C == 0 then 2 else 0;
def BW3c= if Con1C == 0 and Con2C == 0 then 3 else 0;
def BW4c= if Con1C == 0 and Con2C == 1 then 4 else 0;
def SBc = (BW1c + BW2c + BW3c + BW4c);

Plot Dot9 = 9;
Dot9.SetpaintingStrategy(PaintingStrategy.Triangles);
Dot9.SetLineWeight(DotSize);
Dot9.AssignValueColor( if GZone1 == 1 then GlobalColor("GreenZone") else if RZone1 == 1 then GlobalColor("RedZone") else GlobalColor("Neutral"));
Plot Dot10 = 10;
Dot10.SetpaintingStrategy(PaintingStrategy.Triangles);
Dot10.SetLineWeight(DotSize);
Dot10.AssignValueColor( if GZone2 == 1 then GlobalColor("GreenZone") else if RZone2 == 1 then GlobalColor("RedZone") else GlobalColor("Neutral"));
Plot Dot11 = 11;
Dot11.SetpaintingStrategy(PaintingStrategy.Triangles);
Dot11.SetLineWeight(DotSize);
Dot11.AssignValueColor( if GZone3 == 1 then GlobalColor("GreenZone") else if RZone3 == 1 then GlobalColor("RedZone") else GlobalColor("Neutral"));
Plot Dot13 =13;
Dot13.SetpaintingStrategy(PaintingStrategy.Squares);
Dot13.SetLineWeight(3);
Dot13.assignValueColor(if SBa == 1 then GlobalColor("Greenbar") else if SBa == 2 then GlobalColor("Squatbar") else if SBa == 3 then GlobalColor("Fadebar") else if SBa == 4 then GlobalColor("Fakebar") else GlobalColor("Zero"));
Plot Dot14 =14;
Dot14.SetpaintingStrategy(PaintingStrategy.Squares);
Dot14.SetLineWeight(4);
Dot14.assignValueColor(if SBb == 1 then GlobalColor("Greenbar") else if SBb == 2 then GlobalColor("Squatbar") else if SBb == 3 then GlobalColor("Fadebar") else if SBb == 4 then GlobalColor("Fakebar") else GlobalColor("Zero"));
Plot Dot15 =15;
Dot15.SetpaintingStrategy(PaintingStrategy.Squares);
Dot15.SetLineWeight(5);
Dot15.assignValueColor(if SBc == 1 then GlobalColor("Greenbar") else if SBc == 2 then GlobalColor("Squatbar") else if SBc == 3 then GlobalColor("Fadebar") else if SBc == 4 then GlobalColor("Fakebar") else GlobalColor("Zero"));

AssignPriceColor( if APC == 1 and RecP == 1 then Color.Light_Green else if APC == 1 and WarnP == 1 then Color.Orange else if APC == 1 and AcumP == 1 then Color.Green else if APC == 1 and DispP == 1 then Color.Red else if APC ==1 and BullP ==1 then Color.Dark_Green else if  apc == 1 and BearP == 1 then Color.DarK_Red  Else 
if APC == 2 and RecP == 1 then Color.Light_Green else if APC == 2 and WarnP == 2 then Color.Orange else if APC == 2 and AcumP == 2 then Color.Green else if APC == 2 and DispP == 2 then Color.Red else if APC ==2 and BullP ==2 then Color.Dark_Green else if  apc == 2 and BearP == 2 then Color.DarK_Red Else if  APC == 3 and RecP == 3 then Color.Light_Green else if APC == 3 and WarnP == 3 then Color.Orange else if APC == 3 and AcumP == 3 then Color.Green else if APC == 3 and DispP == 3 then Color.Red else if APC ==3 and BullP ==3 then Color.Dark_Green else if  apc == 3 and BearP == 3 then Color.DarK_Red  Else if APC ==5 and Trend == 1 then Color.Dark_Red else if APC == 5 and Trend == 2 then color.Green else if APC==5 and Trend == 3 then Color.Dark_Green else if APC ==5 and Trend ==4 then Color.Red else if APC ==6 and TrendB == 1 then Color.Dark_Red else if APC == 6 and TrendB == 2 then color.Green else if APC==6 and TrendB == 3 then Color.Dark_Green else if APC ==6 and TrendB ==4 then Color.Red else if APC ==7 and TrendC == 1 then Color.Dark_Red else if APC == 7 and TrendC == 2 then color.Green else if APC==7 and TrendC == 3 then Color.Dark_Green else if APC ==7 and TrendC ==4 then Color.Red else if apc == 9 and GZone1 == 1 then GlobalColor("GreenZone") else if apc == 9 and RZone1 == 1 then GlobalColor("RedZone") else if apc ==9 and GZone1 == 0 and RZone1 == 0 then GlobalColor("Neutral") else if apc == 10 and GZone2 == 1 then GlobalColor("GreenZone") else if apc == 10 and RZone2 == 1 then GlobalColor("RedZone") else if apc == 10 and Gzone2 ==0 and RZone2 == 0 then GlobalColor("Neutral") else if apc == 11 and GZone3 == 1 then GlobalColor("GreenZone") else if  apc == 11 and RZone3 == 1 then GlobalColor("RedZone") else if apc == 11 and Gzone3 ==0 and RZone3 ==0 then GlobalColor("Neutral") else if apc == 13 and SBa == 1 then GlobalColor(“Greenbar”) else if APC == 13 and SBa == 2 then GlobalColor(“Squatbar”) else if apc == 13 and SBa == 3 then GlobalColor(“Fadebar”) else if apc == 13 and SBa == 4 then GlobalColor(“Fakebar”) else if apc == 14 and SBb == 1 then GlobalColor(“Greenbar”) else if APC == 14 and SBb == 2 then GlobalColor(“Squatbar”) else if apc == 14 and SBb == 3 then GlobalColor(“Fadebar”) else if apc == 14 and SBb == 4 then GlobalColor(“Fakebar”)else if apc == 15 and SBc == 1 then GlobalColor(“Greenbar”) else if APC == 15 and SBc == 2 then GlobalColor(“Squatbar”) else if apc == 15 and SBc == 3 then GlobalColor(“Fadebar”) else if apc ==15 and SBc == 4 then GlobalColor(“Fakebar”) else Color.current);
 
I cannot take credit for the below but i am not sure where i found this : it was free but has worked for me and only uses the VMA. not sure if its even really helpful.

input ChartBubblesOn = No;

input price = close;
input length = 10;

def tmp1 = if price > price[1] then price - price[1] else 0;
def tmp2 = if price[1] > price then price[1] - price else 0;
def d2 = sum(tmp1, length);
def d4 = sum(tmp2, length);
def cond = d2 + d4 == 0;
def ad3 = if cond then 0 else (d2 - d4) / (d2 + d4) * 100;
def coeff = 2 / (length + 1) * AbsValue(ad3) / 100;
def asd = compoundValue("visible data" = coeff * price + (if IsNaN(asd[1]) then 0 else asd[1]) * (1 - coeff), "historical data" = price
);
plot VMA = asd;
VMA.setDefaultColor(GetColor(0));

def vwma8 = sum(volume * close, 8) / sum(volume, 8);
def vwma21 = sum(volume * close, 21) / sum(volume, 21);
def vwma34 = sum(volume * close, 34) / sum(volume, 34);

def bullish = if vwma8 > vwma21 and vwma21 > vwma34 then 1 else 0;
def bearish = if vwma8 < vwma21 and vwma21 < vwma34 then 1 else 0;
def distribution = if !bullish and !bearish then 1 else 0;

AddLabel(yes, if bullish then "Acceleration" else if bearish then "Deceleration" else if close>=VMA then "Accumulation" else "Distribution", if bullish then color.green else if bearish then color.red else if close >=VMA then color.yellow else color.orange);

VMA.AssignValueColor(if bearish and close<= VMA then color.red
else if bullish and close >= VMA then color.green
else color.gray);

def accumulationToAcceleration = if (bullish and close>=VMA) then 1 else 0;
AddChartBubble(ChartBubblesOn and accumulationToAcceleration and !accumulationToAcceleration[1], close, "Entering Acceleration", color.green);

def distributionToDeceleration = if (bearish and close <= VMA) then 1 else 0;
AddChartBubble(ChartBubblesOn and distributionToDeceleration and !distributionToDeceleration[1], close, "Entering Deceleration", color.red);
 
And here is another lol I found this in archives Yahoo Group I'm running it and also MTF
https://tos.mx/Nlsf7BP
I had to change your Signal Line
Code:
# from TOS YahooGroups
# DojiDog_MTFT3OSC

declare lower;

#hint Method: Set caculation method to use T3 MA or T3 Oscillator.
input Method = {default MA, OSC};
def Period1 = GetAggregationPeriod();
def Period2;
def Period3;
def Period4;
def Period5;
def MALen3 = 3;
def MALen5 = 5;
def CalcMethod;

switch (Method)
{
    case MA:
       CalcMethod = 1;
    default:
       CalcMethod = 0;
}

if Period1 == AggregationPeriod.FIVE_MIN then
{
    Period2 = AggregationPeriod.FIFTEEN_MIN;
    Period3 = AggregationPeriod.THIRTY_MIN;
    Period4 = AggregationPeriod.HOUR;
    Period5 = AggregationPeriod.TWO_HOURS;
}
else
if Period1 == AggregationPeriod.FIFTEEN_MIN then
{
    Period2 = AggregationPeriod.THIRTY_MIN;
    Period3 = AggregationPeriod.HOUR;
    Period4 = AggregationPeriod.TWO_HOURS;
    Period5 = AggregationPeriod.FOUR_HOURS;
}
else
if Period1 == AggregationPeriod.THIRTY_MIN then
{
    Period2 = AggregationPeriod.HOUR;
    Period3 = AggregationPeriod.TWO_HOURS;
    Period4 = AggregationPeriod.FOUR_HOURS;
    Period5 = AggregationPeriod.DAY;
}
else if Period1 == AggregationPeriod.HOUR then
{
    Period2 = AggregationPeriod.TWO_HOURS;
    Period3 = AggregationPeriod.FOUR_HOURS;
    Period4 = AggregationPeriod.DAY;
    Period5 = AggregationPeriod.TWO_DAYS;
}
else if Period1 == AggregationPeriod.TWO_HOURS then
{
    Period2 = AggregationPeriod.FOUR_HOURS;
    Period3 = AggregationPeriod.DAY;
    Period4 = AggregationPeriod.TWO_DAYS;
    Period5 = AggregationPeriod.THREE_DAYS;
}
else if Period1 == AggregationPeriod.FOUR_HOURS then
{
    Period2 = AggregationPeriod.DAY;
    Period3 = AggregationPeriod.TWO_DAYS;
    Period4 = AggregationPeriod.THREE_DAYS;
    Period5 = AggregationPeriod.FOUR_DAYS;
}
else
{
    Period2 = AggregationPeriod.TWO_DAYS;
    Period3 = AggregationPeriod.THREE_DAYS;
    Period4 = AggregationPeriod.FOUR_DAYS;
    Period5 = AggregationPeriod.WEEK;
}
    
script TOSMa {
    input MAPrice = close;
    input MALen = 1;
    def C1 = (-.618) * .618 * .618;
    def C2 = (3 * .618 * .618) + (3 * .618 * .618 * .618);
    def C3 = (-6 * .618 * .618) - (3 * .618) - (3 * .618 * .618 * .618);
    def C4 = 1 + (3 * .618) + (.618 * .618 * .618) + (3 * .618 * .618);
    def MA1 = ExpAverage(MAPrice, MALen);
    def MA2 = ExpAverage(MA1, MALen);
    def MA3 = ExpAverage(MA2, MALen);
    def MA4 = ExpAverage(MA3, MALen);
    def MA5 = ExpAverage(MA4, MALen);
    def MA6 = ExpAverage(MA5, MALen);
    plot MA7 = (C1 * MA6) + (C2 * MA5) + (C3 * MA4) + (C4 * MA3);
}

def ClosePeriod1 = close;
def ClosePeriod2 = close( period = Period2);
def ClosePeriod3 = close( period = Period3);
def ClosePeriod4 = close( period = Period4);
def ClosePeriod5 = close( period = Period5);

script SetDotColors {
    input LevelClose = 1.0;
    input TOSC = 1.0;
    input TOSCBack = 1.0;
    input Level3MA = 1.0;
    input Level5MA = 1.0;
    input CalcType = 1;

    def Bullish = (CalcType == 1 and Level3MA > Level5MA and LevelClose > Level3MA) or (CalcType == 0 and TOSC > TOSCBack and LevelClose > Level3MA);
    def Bearish = (CalcType == 1 and Level3MA < Level5MA and LevelClose < Level3MA) or (CalcType == 0 and TOSC < TOSCBack and LevelClose < Level3MA);
    plot DotColorFlag = if Bullish then 1 else if Bearish then -1 else 0;
}

def T3MAL1 = TOSMa(close, MALen3);
def T5MAL1 = TOSMa(close, MALen5);
def T3SngMAL1 = SimpleMovingAvg(T3MAL1 - T5MAL1[1], 3);
def T3SngL1 = T3SngMAL1[1];
def T3MAL2 = TOSMa(close( period = Period2), MALen3);
def T5MAL2 = TOSMa(close( period = Period2), MALen5);
def T3SngMAL2 = SimpleMovingAvg(T3MAL2 - T5MAL2[1], 3);
def T3SngL2 = T3SngMAL2[1];
def T3MAL3 = TOSMa(close( period = Period3), MALen3);
def T5MAL3 = TOSMa(close( period = Period3), MALen5);
def T3SngMAL3 = SimpleMovingAvg(T3MAL3 - T5MAL3[1], 3);
def T3SngL3 = T3SngMAL3[1];
def T3MAL4 = TOSMa(close( period = Period4), MALen3);
def T5MAL4 = TOSMa(close( period = Period4), MALen5);
def T3SngMAL4 = SimpleMovingAvg(T3MAL4 - T5MAL4[1], 3);
def T3SngL4 = T3SngMAL4[1];
def T3MAL5 = TOSMa(close( period = Period5), MALen3);
def T5MAL5 = TOSMa(close( period = Period5), MALen5);
def T3SngMAL5 = SimpleMovingAvg(T3MAL5 - T5MAL5[1], 3);
def T3SngL5 = T3SngMAL5[1];

def Period1Status = SetDotColors(close, T3SngMAL1, T3SngL1, T3MAL1, T5MAL1, CalcMethod);


def Period2Status = SetDotColors(ClosePeriod2, T3SngMAL2, T3SngL2, T3MAL2, T5MAL2, CalcMethod);
def Period3Status = SetDotColors(ClosePeriod3, T3SngMAL3, T3SngL3, T3MAL3, T5MAL3, CalcMethod);
def Period4Status = SetDotColors(ClosePeriod4, T3SngMAL4, T3SngL4, T3MAL4, T5MAL4, CalcMethod);
def Period5Status = SetDotColors(ClosePeriod5, T3SngMAL5, T3SngL5, T3MAL5, T5MAL5, CalcMethod);

plot TOSCMADotsL1 = if IsNAN(Close) then Double.Nan else 0;
TOSCMADotsL1.SetStyle(Curve.POINTS);
TOSCMADotsL1.SetLineWeight(5);
TOSCMADotsL1.AssignValueColor(if Period1Status == 1 then color.GREEN else if Period1Status == -1 then color.RED else Color.BLue);
plot TOSCMADotsL2 = if IsNAN(close) then Double.Nan else 1;
TOSCMADotsL2.SetStyle(Curve.POINTS);
TOSCMADotsL2.SetLineWeight(5);
TOSCMADotsL2.AssignValueColor(if Period2Status == 1 then color.GREEN else if Period2Status == -1 then color.RED else Color.BLue);
plot TOSCMADotsL3 = if IsNAN(close) then Double.Nan else 2;
TOSCMADotsL3.SetStyle(Curve.POINTS);
TOSCMADotsL3.SetLineWeight(5);
TOSCMADotsL3.AssignValueColor(if Period3Status == 1 then color.GREEN else if Period3Status == -1 then color.RED else Color.BLue);
plot TOSCMADotsL4 = if IsNAN(close) then Double.Nan else 3;
TOSCMADotsL4.SetStyle(Curve.POINTS);
TOSCMADotsL4.SetLineWeight(5);
TOSCMADotsL4.AssignValueColor(if Period4Status == 1 then color.GREEN else if Period4Status == -1 then color.RED else Color.BLue);
plot TOSCMADotsL5 = if IsNAN(close) then Double.Nan else 4;
TOSCMADotsL5.SetStyle(Curve.POINTS);
TOSCMADotsL5.SetLineWeight(5);
TOSCMADotsL5.AssignValueColor(if Period5Status == 1 then color.GREEN else if Period5Status == -1 then color.RED else Color.BLue);
plot SectLine = if IsNAN(Close) then Double.Nan else 5;
SectLine.AssignValueColor(Color.WHITE);
plot TOSCMADotsSig = if IsNAN(Close) then Double.Nan else 6;
TOSCMADotsSig.SetStyle(Curve.POINTS);
TOSCMADotsSig.SetLineWeight(5);
#TOSCMADotsSig.AssignValueColor(if Period1Status == 1 and Period2Status == 1 and Period3Status == 1 and Period4Status == 1  and Period5Status == 1 then color.GREEN else if Period1Status == -1 and Period2Status == -1 and Period3Status == -1 and Period4Status == -1 and Period5Status == -1 then color.RED else color.GRAY);
def Status = (Period1Status + Period2Status + Period3Status + Period4Status +Period5Status);

TOSCMADotsSig.AssignValueColor(if Status > 0 then Color.Green else if Status <0 then Color.Red else Color.Gray);
 
I had to change your Signal Line
Code:
# from TOS YahooGroups
# DojiDog_MTFT3OSC

declare lower;

#hint Method: Set caculation method to use T3 MA or T3 Oscillator.
input Method = {default MA, OSC};
def Period1 = GetAggregationPeriod();
def Period2;
def Period3;
def Period4;
def Period5;
def MALen3 = 3;
def MALen5 = 5;
def CalcMethod;

switch (Method)
{
    case MA:
       CalcMethod = 1;
    default:
       CalcMethod = 0;
}

if Period1 == AggregationPeriod.FIVE_MIN then
{
    Period2 = AggregationPeriod.FIFTEEN_MIN;
    Period3 = AggregationPeriod.THIRTY_MIN;
    Period4 = AggregationPeriod.HOUR;
    Period5 = AggregationPeriod.TWO_HOURS;
}
else
if Period1 == AggregationPeriod.FIFTEEN_MIN then
{
    Period2 = AggregationPeriod.THIRTY_MIN;
    Period3 = AggregationPeriod.HOUR;
    Period4 = AggregationPeriod.TWO_HOURS;
    Period5 = AggregationPeriod.FOUR_HOURS;
}
else
if Period1 == AggregationPeriod.THIRTY_MIN then
{
    Period2 = AggregationPeriod.HOUR;
    Period3 = AggregationPeriod.TWO_HOURS;
    Period4 = AggregationPeriod.FOUR_HOURS;
    Period5 = AggregationPeriod.DAY;
}
else if Period1 == AggregationPeriod.HOUR then
{
    Period2 = AggregationPeriod.TWO_HOURS;
    Period3 = AggregationPeriod.FOUR_HOURS;
    Period4 = AggregationPeriod.DAY;
    Period5 = AggregationPeriod.TWO_DAYS;
}
else if Period1 == AggregationPeriod.TWO_HOURS then
{
    Period2 = AggregationPeriod.FOUR_HOURS;
    Period3 = AggregationPeriod.DAY;
    Period4 = AggregationPeriod.TWO_DAYS;
    Period5 = AggregationPeriod.THREE_DAYS;
}
else if Period1 == AggregationPeriod.FOUR_HOURS then
{
    Period2 = AggregationPeriod.DAY;
    Period3 = AggregationPeriod.TWO_DAYS;
    Period4 = AggregationPeriod.THREE_DAYS;
    Period5 = AggregationPeriod.FOUR_DAYS;
}
else
{
    Period2 = AggregationPeriod.TWO_DAYS;
    Period3 = AggregationPeriod.THREE_DAYS;
    Period4 = AggregationPeriod.FOUR_DAYS;
    Period5 = AggregationPeriod.WEEK;
}
   
script TOSMa {
    input MAPrice = close;
    input MALen = 1;
    def C1 = (-.618) * .618 * .618;
    def C2 = (3 * .618 * .618) + (3 * .618 * .618 * .618);
    def C3 = (-6 * .618 * .618) - (3 * .618) - (3 * .618 * .618 * .618);
    def C4 = 1 + (3 * .618) + (.618 * .618 * .618) + (3 * .618 * .618);
    def MA1 = ExpAverage(MAPrice, MALen);
    def MA2 = ExpAverage(MA1, MALen);
    def MA3 = ExpAverage(MA2, MALen);
    def MA4 = ExpAverage(MA3, MALen);
    def MA5 = ExpAverage(MA4, MALen);
    def MA6 = ExpAverage(MA5, MALen);
    plot MA7 = (C1 * MA6) + (C2 * MA5) + (C3 * MA4) + (C4 * MA3);
}

def ClosePeriod1 = close;
def ClosePeriod2 = close( period = Period2);
def ClosePeriod3 = close( period = Period3);
def ClosePeriod4 = close( period = Period4);
def ClosePeriod5 = close( period = Period5);

script SetDotColors {
    input LevelClose = 1.0;
    input TOSC = 1.0;
    input TOSCBack = 1.0;
    input Level3MA = 1.0;
    input Level5MA = 1.0;
    input CalcType = 1;

    def Bullish = (CalcType == 1 and Level3MA > Level5MA and LevelClose > Level3MA) or (CalcType == 0 and TOSC > TOSCBack and LevelClose > Level3MA);
    def Bearish = (CalcType == 1 and Level3MA < Level5MA and LevelClose < Level3MA) or (CalcType == 0 and TOSC < TOSCBack and LevelClose < Level3MA);
    plot DotColorFlag = if Bullish then 1 else if Bearish then -1 else 0;
}

def T3MAL1 = TOSMa(close, MALen3);
def T5MAL1 = TOSMa(close, MALen5);
def T3SngMAL1 = SimpleMovingAvg(T3MAL1 - T5MAL1[1], 3);
def T3SngL1 = T3SngMAL1[1];
def T3MAL2 = TOSMa(close( period = Period2), MALen3);
def T5MAL2 = TOSMa(close( period = Period2), MALen5);
def T3SngMAL2 = SimpleMovingAvg(T3MAL2 - T5MAL2[1], 3);
def T3SngL2 = T3SngMAL2[1];
def T3MAL3 = TOSMa(close( period = Period3), MALen3);
def T5MAL3 = TOSMa(close( period = Period3), MALen5);
def T3SngMAL3 = SimpleMovingAvg(T3MAL3 - T5MAL3[1], 3);
def T3SngL3 = T3SngMAL3[1];
def T3MAL4 = TOSMa(close( period = Period4), MALen3);
def T5MAL4 = TOSMa(close( period = Period4), MALen5);
def T3SngMAL4 = SimpleMovingAvg(T3MAL4 - T5MAL4[1], 3);
def T3SngL4 = T3SngMAL4[1];
def T3MAL5 = TOSMa(close( period = Period5), MALen3);
def T5MAL5 = TOSMa(close( period = Period5), MALen5);
def T3SngMAL5 = SimpleMovingAvg(T3MAL5 - T5MAL5[1], 3);
def T3SngL5 = T3SngMAL5[1];

def Period1Status = SetDotColors(close, T3SngMAL1, T3SngL1, T3MAL1, T5MAL1, CalcMethod);


def Period2Status = SetDotColors(ClosePeriod2, T3SngMAL2, T3SngL2, T3MAL2, T5MAL2, CalcMethod);
def Period3Status = SetDotColors(ClosePeriod3, T3SngMAL3, T3SngL3, T3MAL3, T5MAL3, CalcMethod);
def Period4Status = SetDotColors(ClosePeriod4, T3SngMAL4, T3SngL4, T3MAL4, T5MAL4, CalcMethod);
def Period5Status = SetDotColors(ClosePeriod5, T3SngMAL5, T3SngL5, T3MAL5, T5MAL5, CalcMethod);

plot TOSCMADotsL1 = if IsNAN(Close) then Double.Nan else 0;
TOSCMADotsL1.SetStyle(Curve.POINTS);
TOSCMADotsL1.SetLineWeight(5);
TOSCMADotsL1.AssignValueColor(if Period1Status == 1 then color.GREEN else if Period1Status == -1 then color.RED else Color.BLue);
plot TOSCMADotsL2 = if IsNAN(close) then Double.Nan else 1;
TOSCMADotsL2.SetStyle(Curve.POINTS);
TOSCMADotsL2.SetLineWeight(5);
TOSCMADotsL2.AssignValueColor(if Period2Status == 1 then color.GREEN else if Period2Status == -1 then color.RED else Color.BLue);
plot TOSCMADotsL3 = if IsNAN(close) then Double.Nan else 2;
TOSCMADotsL3.SetStyle(Curve.POINTS);
TOSCMADotsL3.SetLineWeight(5);
TOSCMADotsL3.AssignValueColor(if Period3Status == 1 then color.GREEN else if Period3Status == -1 then color.RED else Color.BLue);
plot TOSCMADotsL4 = if IsNAN(close) then Double.Nan else 3;
TOSCMADotsL4.SetStyle(Curve.POINTS);
TOSCMADotsL4.SetLineWeight(5);
TOSCMADotsL4.AssignValueColor(if Period4Status == 1 then color.GREEN else if Period4Status == -1 then color.RED else Color.BLue);
plot TOSCMADotsL5 = if IsNAN(close) then Double.Nan else 4;
TOSCMADotsL5.SetStyle(Curve.POINTS);
TOSCMADotsL5.SetLineWeight(5);
TOSCMADotsL5.AssignValueColor(if Period5Status == 1 then color.GREEN else if Period5Status == -1 then color.RED else Color.BLue);
plot SectLine = if IsNAN(Close) then Double.Nan else 5;
SectLine.AssignValueColor(Color.WHITE);
plot TOSCMADotsSig = if IsNAN(Close) then Double.Nan else 6;
TOSCMADotsSig.SetStyle(Curve.POINTS);
TOSCMADotsSig.SetLineWeight(5);
#TOSCMADotsSig.AssignValueColor(if Period1Status == 1 and Period2Status == 1 and Period3Status == 1 and Period4Status == 1  and Period5Status == 1 then color.GREEN else if Period1Status == -1 and Period2Status == -1 and Period3Status == -1 and Period4Status == -1 and Period5Status == -1 then color.RED else color.GRAY);
def Status = (Period1Status + Period2Status + Period3Status + Period4Status +Period5Status);

TOSCMADotsSig.AssignValueColor(if Status > 0 then Color.Green else if Status <0 then Color.Red else Color.Gray);
WOW! Thanks for this
 

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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