• Get $30 off VIP with code SUMMER30. Ends July 27. Happy trading!

My version of the TTM Trend for ThinkorSwim

henry1224

Active member
VIP
Here is my version of the TTM Trend "5 Bar" It does not match up bar for bar, but as an indicator it works out.

Code:
####################################################
declare Lower;
def o = Open;
def C = Close;
def H = High;
def L = Low;
def data = Sum((O+H+L+C)/4,6)/6;
def TRend1 = if C >= data then 1 else 0;
def TRend2 = if C >= data[1] then 1 else 0;
def TRend3 = if C >= data[2] then 1 else 0;
def TRend4 = if C >= data[3] then 1 else 0;
def TRend5 = if C >= data[4] then 1 else 0;
def half = 2.5;
Plot TotalT = (TRend1 + TRend2 + TRend3 + TRend4 + Trend5);
TotalT.AssignValueColor(if TotalT < half then Color.RED else Color.GREEN);
TotalT.setLineWeight(3);
AddCloud(TotalT, Half, Color.Light_Green, Color.Light_Red, no);
#################################################

Here is the Labels for the above indicator they will show support from the higher time frames. Plot several of them in the same section of the chart.

Code:
##################################################

declare lower;
input period = AggregationPeriod.DAY;
DefineGlobalColor("Long", Color.Green);
DefineGlobalColor("Short", Color.RED);
DefineGlobalColor("Neutral", Color.Yellow);
DefineGlobalColor("arrow Buy", Color.Cyan);
DefineGlobalColor("arrow Sell", Color.Orange);
Script SymbolTTrend{
input period = AggregationPeriod.DAY;
def OP = Open(period= period);
def CP = Close(Period= period);
def HP = High(period= period);
def LP = Low(Period= period);
def data = Sum((OP+HP+LP+CP)/4,6)/6;
def TRend1 = if CP >= data then 1 else 0;
def TRend2 = if CP >= data[1] then 1 else 0;
def TRend3 = if CP >= data[2] then 1 else 0;
def TRend4 = if CP >= data[3] then 1 else 0;
def TRend5 = if CP >= data[4] then 1 else 0;
Def TotalT = (TRend1 + TRend2 + TRend3 + TRend4 + Trend5);
Plot Result =  If TotalT > 2.5 then 1 else 0;}
Script SymbolSignal{
input period = AggregationPeriod.DAY;
def OP = Open(period= period);
def CP = Close(Period= period);
def HP = High(period= period);
def LP = Low(Period= period);
def data = Sum((OP+HP+LP+CP)/4,6)/6;
def TRend1 = if CP >= data then 1 else 0;
def TRend2 = if CP >= data[1] then 1 else 0;
def TRend3 = if CP >= data[2] then 1 else 0;
def TRend4 = if CP >= data[3] then 1 else 0;
def TRend5 = if CP >= data[4] then 1 else 0;
Def TotalT = (TRend1 + TRend2 + TRend3 + TRend4 + Trend5);
Plot Result =  If TotalT crosses Above 2.5 then 1 else If TotalT Crosses Below 2.5 then -1 else 0;}
def currentPeriod = GetAggregationPeriod();
def s1;
def h1;

if period >= currentPeriod {
    s1 = SymbolTTrend(period = period );
    h1 = SymbolSignal(period = period);
} else {
    s1 = Double.NaN;
    h1 = DOuble.Nan;
}
AddLabel(!IsNaN(s1), "TTMT:" + (if period == AggregationPeriod.MONTH then "M"
else
if period == AggregationPeriod.WEEK then "W"
else
if period == AggregationPeriod.FOUR_DAYS then "4D"
else
if period == AggregationPeriod.THREE_DAYS then "3D"
else
if period == AggregationPeriod.TWO_DAYS then "2D"
else
if period  == AggregationPeriod.DAY then "D"
else
if period == AggregationPeriod.FOUR_HOURS then "4H"
else
if period == AggregationPeriod.TWO_HOURS then "2H"
else
if period == AggregationPeriod.HOUR then "60m"
else
if period == AggregationPeriod.THIRTY_MIN then "30m"
else
if period == AggregationPeriod.TWENTY_MIN then "20m"
else
if period  == AggregationPeriod.FIFTEEN_MIN then "15m"
else
if period == AggregationPeriod.TEN_MIN then "10m"
else
if period == AggregationPeriod.FIVE_MIN then "5m"
else
if period == AggregationPeriod.FOUR_MIN then "4m"
else
if period  == AggregationPeriod.THREE_MIN then "3m"
else
if period == AggregationPeriod.TWO_MIN then "2m"
else
if period  == AggregationPeriod.MIN then "1m"
else ""), if s1 == 1 then GlobalColor("Long") else if s1 == 0 then GlobalColor("Short") else GlobalColor("Neutral"));
AddLabel(!IsNaN(h1) and h1 != 0, If h1 == 1 then "B" else if h1 == -1 then "S" else "-", if h1 == 1 then GlobalColor("arrow Buy") else if h1 == -1 then GlobalColor("arrow Sell") else color.gray);

TTM Trend Multi-TimeFrame

Code:
##############################
Declare Lower;
# GLOBAL DEFINITIONS

DefineGlobalColor("TrendUp", CreateColor(0, 254, 30));
DefineGlobalColor("TrendDown", CreateColor(255, 3, 2));

input agg = AggregationPeriod.FIVE_MIN;
input agg2 = AggregationPeriod.THIRTY_MIN;
input agg3 = AggregationPeriod.HOUR;
input agg4 = AggregationPeriod.TWO_Hours;;
input agg5 = AggregationPeriod.FOUR_HOURs;
input agg6 = AggregationPeriod.DAY;
input DotSize = 3;
input n = 6;
def n1  = n + 1;

#Aggregation 1

def o = Open(Period = AGG);
def C = Close(Period =AGG);
def H = High(Period = AGG);
def L = Low(Period = AGG);
def Adata = Sum((O+H+L+C)/4,6)/6;
def ATRend1 = if C >= Adata then 1 else 0;
def ATRend2 = if C >= Adata[1] then 1 else 0;
def ATRend3 = if C >= Adata[2] then 1 else 0;
def ATRend4 = if C >= Adata[3] then 1 else 0;
def ATRend5 = if C >= Adata[4] then 1 else 0;
Def TotalT = (ATRend1 + ATRend2 + ATRend3 + ATRend4 + ATrend5);
plot TT1_Dot = if IsNaN(c) then Double.NaN else 1;
TT1_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
TT1_Dot.SetLineWeight(DotSize);
TT1_Dot.AssignValueColor(if 2.5 > TotalT then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
AddChartBubble(!IsNaN(c [n1]) and IsNaN(c [n]), 1, (agg/1000/60) + " min", Color.Yellow, yes);

#Aggregation 2

def o2 = Open(Period = AGG2);
def C2 = Close(Period =AGG2);
def H2 = High(Period = AGG2);
def L2 = Low(Period = AGG2);
def Bdata = Sum((O2+H2+L2+C2)/4,6)/6;
def BTRend1 = if C2 >= Bdata then 1 else 0;
def BTRend2 = if C2 >= Bdata[1] then 1 else 0;
def BTRend3 = if C2 >= Bdata[2] then 1 else 0;
def BTRend4 = if C2 >= Bdata[3] then 1 else 0;
def BTRend5 = if C2 >= Bdata[4] then 1 else 0;
Def TotalT2 = (BTRend1 + BTRend2 + BTRend3 + BTRend4 + BTrend5);
plot TT2_Dot = if IsNaN(c2) then Double.NaN else 2;
TT2_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
TT2_Dot.SetLineWeight(DotSize);
TT2_Dot.AssignValueColor(if 2.5 > TotalT2 then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
AddChartBubble(!IsNaN(c2[n1]) and IsNaN(c2[n]), 2, (agg2/1000/60) + " min", Color.Yellow, yes);

#Aggregation 3

def O3 = Open(Period = AGG3);
def C3 = Close(Period =AGG3);
def H3 = High(Period = AGG3);
def L3 = Low(Period = AGG3);
def Cdata = Sum((O3+H3+L3+C3)/4,6)/6;
def CTRend1 = if C3 >= Cdata then 1 else 0;
def CTRend2 = if C3 >= Cdata[1] then 1 else 0;
def CTRend3 = if C3 >= Cdata[2] then 1 else 0;
def CTRend4 = if C3 >= Cdata[3] then 1 else 0;
def CTRend5 = if C3 >= Cdata[4] then 1 else 0;
Def TotalT3 = (CTRend1 + CTRend2 + CTRend3 + CTRend4 + CTrend5);
plot TT3_Dot = if IsNaN(c3) then Double.NaN else 3;
TT3_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
TT3_Dot.SetLineWeight(DotSize);
TT3_Dot.AssignValueColor(if 2.5 > TotalT3 then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
AddChartBubble(!IsNaN(c3[n1]) and IsNaN(c3[n]), 3, (agg3/1000/60) + " min", Color.Yellow, yes);

#Aggregation 4

def O4 = Open(Period = AGG4);
def C4 = Close(Period =AGG4);
def H4 = High(Period = AGG4);
def L4= Low(Period = AGG4);
def Ddata = Sum((O4+H4+L4+C4)/4,6)/6;
def DTRend1 = if C4 >= Ddata then 1 else 0;
def DTRend2 = if C4 >= Ddata[1] then 1 else 0;
def DTRend3 = if C4 >= Ddata[2] then 1 else 0;
def DTRend4 = if C4 >= Ddata[3] then 1 else 0;
def DTRend5 = if C4 >= Ddata[4] then 1 else 0;
Def TotalT4 = (DTRend1 + DTRend2 + DTRend3 + DTRend4 + DTrend5);
plot TT4_Dot = if IsNaN(c4) then Double.NaN else 4;
TT4_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
TT4_Dot.SetLineWeight(DotSize);
TT4_Dot.AssignValueColor(if 2.5 > TotalT4 then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
AddChartBubble(!IsNaN(c4[n1]) and IsNaN(c4[n]), 4, (agg4/1000/60) + " min", Color.Yellow, yes);

#Aggregation 5

def O5 = Open(Period = AGG5);
def C5 = Close(Period =AGG5);
def H5 = High(Period = AGG5);
def L5 = Low(Period = AGG5);
def Edata = Sum((O5+H5+L5+C5)/4,6)/6;
def ETRend1 = if C5 >= Edata then 1 else 0;
def ETRend2 = if C5 >= Edata[1] then 1 else 0;
def ETRend3 = if C5 >= Edata[2] then 1 else 0;
def ETRend4 = if C5 >= Edata[3] then 1 else 0;
def ETRend5 = if C5 >= Edata[4] then 1 else 0;
Def TotalT5 = (ETRend1 + ETRend2 + ETRend3 + ETRend4 + ETrend5);
plot TT5_Dot = if IsNaN(c5) then Double.NaN else 5;
TT5_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
TT5_Dot.SetLineWeight(DotSize);
TT5_Dot.AssignValueColor(if 2.5 >  TotalT5 then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
AddChartBubble(!IsNaN(c5[n1]) and IsNaN(c5[n]), 5, (agg5/1000/60) + " min", Color.Yellow, yes);

#Aggregation 6

def O6 = Open(Period = AGG6);
def C6 = Close(Period =AGG6);
def H6 = High(Period = AGG6);
def L6 = Low(Period = AGG6);
def Fdata = Sum((O6+H6+L6+C6)/4,6)/6;
def FTRend1 = if C6 >= Fdata then 1 else 0;
def FTRend2 = if C6 >= Fdata[1] then 1 else 0;
def FTRend3 = if C6 >= Fdata[2] then 1 else 0;
def FTRend4 = if C6 >= Fdata[3] then 1 else 0;
def FTRend5 = if C6 >= Fdata[4] then 1 else 0;
Def TotalT6 = (FTRend1 + FTRend2 + FTRend3 + FTRend4 + FTrend5);
plot TT6_Dot = if IsNaN(C6) then Double.NaN else 6;
TT6_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
TT6_Dot.SetLineWeight(DotSize);
TT6_Dot.AssignValueColor(if 2.5 >  TotalT6 then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
AddChartBubble(!IsNaN(C6[n1]) and IsNaN(C6[n]), 6, (agg6/1000/60) + " min", Color.Yellow, yes);
Def Bull = ((TotalT6[1] > TotalT6) + (TotalT5[1] > TotalT5) + (TotalT4[1] > TotalT4) + (TotalT3[1] > TotalT3) + (TotalT2[1] > TotalT2) + (TotalT[1] > TotalT));
Def Bear = ((TotalT6[1] < TotalT6) + (TotalT5[1] < TotalT5) + (TotalT4[1] < TotalT4) + (TotalT3[1] < TotalT3) + (TotalT2[1] < TotalT2) + (TotalT[1] < TotalT));
Alert(Bull >3,"", Alert.BAR, Sound.Chimes);
Alert (Bear >3,"", Alert.BAR, Sound.Chimes);
 
Last edited:

Pelonsax

Active member
VIP
You're a firkin GENIUS!

My only comment: if you've already made all the other ones MTF, Might as well make the candle color study MTF as well!

Code:
###################################################
declare UPPER;
input period = AggregationPeriod.FIVE_MIN;
def o = Open(period = Period);
def C = Close(period = Period);
def H = High(period = Period);
def L = Low(period = Period);
def data = Sum((O+H+L+C)/4,6)/6;
def TRend1 = if C >= data then 1 else 0;
def TRend2 = if C >= data[1] then 1 else 0;
def TRend3 = if C >= data[2] then 1 else 0;
def TRend4 = if C >= data[3] then 1 else 0;
def TRend5 = if C >= data[4] then 1 else 0;
def half = 2.5;
def TotalT = (TRend1 + TRend2 + TRend3 + TRend4 + Trend5);
#TotalT.AssignValueColor(if TotalT < half then Color.RED else Color.GREEN);
#TotalT.setLineWeight(3);
AssignPriceColor(if TotalT then Color.Light_Green else if half then Color.Light_Red else color.CURRENT);
#################################################
 

henry1224

Active member
VIP
If you add the Labels indicator like 4 or 5 times to the same chart area , it will give you MTF of the first indicator
 

KevinSammy

Member
VIP
Hello @Pelonsax,

Can you please provide a link or comment on this thread if/when you update for script that does NOT repaint?
I just subscribed to this thread so that I'm notified...otherwise, if you open a new thread folks like me won't know :)


Thank YOU!!
 

TraderGary

New member
It does at that. I'm about to bring in some code that I think does not repaint. But it's based on something slightly different. I'll start a new thread

@Pelonsax Is it repainting on the current bar or on previous bars? Because if it's repainting on the current bar, I would think that's just because the bar has not closed yet, and the trend has changed within that bar?

I love this indicator and plan to use it for trend definition in a MTF strategy I am currently building in TOS. But if it's repainting past bars, it may not be useful for my intentions.
 

henry1224

Active member
VIP
Where the first version took the sum of 5 trends and only showed signals if more than half were above or below "which I feel that was contributing to the problems

This version plots them separately over 3 time frames

Code:
##TTM_Trend_6_Bar_w_3_MTF
here is the code

Declare Lower; 
# GLOBAL DEFINITIONS
DefineGlobalColor("TrendUp", Color.Cyan);
DefineGlobalColor("TrendDown", Color.Magenta);
DefineGlobalColor("ATrendUp", Color.Green);
DefineGlobalColor("ATrendDown", Color.Red);
DefineGlobalColor("BTrendUp", Color.Green);
DefineGlobalColor("BTrendDown", Color.Red);
DefineGlobalColor("CTrendUp", Color.Green);
DefineGlobalColor("CTrendDown", Color.Red);
input agg = AggregationPeriod.FIVE_MIN;
input agg2 = AggregationPeriod.THIRTY_MIN;
input agg3 = AggregationPeriod.HOUR;
input TriSize = 3;
input SqSize = 3;
input n = 20;
Input apc = 1;
def n1  = n + 1;

#Aggregation 1 AT1
def o = Open(Period = AGG);
def C = Close(Period =AGG);
def H = High(Period = AGG);
def L = Low(Period = AGG);
def Adata = Sum((O+ C)/2,6)/6;
def AT1 = if C >= Adata then 1 else 0;
def AT2 = if C[1] >= Adata[1] then 1 else 0;
def AT3 = if C[2] >= Adata[2] then 1 else 0;
def AT4 = if C[3] >= Adata[3] then 1 else 0;
def AT5 = if C[4] >= Adata[4] then 1 else 0;
plot AT1_Dot = if IsNaN(close) then Double.NaN else 1;
AT1_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
AT1_Dot.SetLineWeight(TriSize);
AT1_Dot.AssignValueColor(if AT1 ==0 then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
AddChartBubble(!IsNaN(close [n1]) and IsNaN(Close [n]), 1, (agg/1000/60) + " min", Color.Yellow, yes); 
plot AT2_Dot = if IsNaN(close) then Double.NaN else 2;
AT2_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
AT2_Dot.SetLineWeight(TriSize);
AT2_Dot.AssignValueColor(if AT2 ==0 then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
AddChartBubble(!IsNaN(close [n1]) and IsNaN(Close [n]), 2, (agg/1000/60) + " min", Color.Yellow, yes);
plot AT3_Dot = if IsNaN(close) then Double.NaN else 3;
AT3_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
AT3_Dot.SetLineWeight(TRiSize);
AT3_Dot.AssignValueColor(if AT3==0 then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
AddChartBubble(!IsNaN(close [n1]) and IsNaN(Close [n]),3, (agg/1000/60) + " min", Color.Yellow, yes);
plot AT4_Dot = if IsNaN(close) then Double.NaN else 4;
AT4_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
AT4_Dot.SetLineWeight(TriSize);
AT4_Dot.AssignValueColor(if AT4 ==0 then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
AddChartBubble(!IsNaN(close [n1]) and IsNaN(Close [n]), 4, (agg/1000/60) + " min", Color.Yellow, yes);
plot AT5_Dot = if IsNaN(close) then Double.NaN else 5;
AT5_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
AT5_Dot.SetLineWeight(TRiSize);
AT5_Dot.AssignValueColor(if AT5 ==0 then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
AddChartBubble(!IsNaN(close [n1]) and IsNaN(Close [n]), 5, (agg/1000/60) + " min", Color.Yellow, yes);
def ATOT = (AT1+ AT2 + AT3+ AT4+ AT5);
plot AMTF_Dot = 6;
AMTF_Dot.SetPaintingStrategy(PaintingStrategy.SQUARES);
AMTF_Dot.SetLineWeight(SQSize );
AMTF_Dot.AssignValueColor ( if ATOT >2 then GlobalColor("ATrendUp") else GlobalColor("ATrendDown"));

#Aggregation 2 BT1
def o2 = Open(Period = AGG2);
def C2 = Close(Period =AGG2);
def H2 = High(Period = AGG2);
def L2 = Low(Period = AGG2);
def Bdata = Sum((O2+ C2)/2,6)/6;
def BT1 = if C2 >= Bdata then 1 else 0;
def BT2 = if C2[1] >= Bdata[1] then 1 else 0;
def BT3 = if C2[2] >= Bdata[2] then 1 else 0;
def BT4 = if C2[3] >= Bdata[3] then 1 else 0;
def BT5 = if C2[4] >= Bdata[4] then 1 else 0;
plot BT1_Dot = if IsNaN(Close) then Double.NaN else 8;
BT1_Dot.SetPaintingStrategy(PaintingStrategy.Triangles);
BT1_Dot.SetLineWeight(TriSize);
BT1_Dot.AssignValueColor(if BT1 ==0 then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
AddChartBubble(!IsNaN(Close[n1]) and IsNaN(Close[n]), 8, (agg2/1000/60) + " min", Color.Yellow, yes);
plot BT2_Dot = if IsNaN(Close) then Double.NaN else 9;
BT2_Dot.SetPaintingStrategy(PaintingStrategy.Triangles);
BT2_Dot.SetLineWeight(TriSize);
BT2_Dot.AssignValueColor(if BT2 ==0 then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
AddChartBubble(!IsNaN(Close[n1]) and IsNaN(Close[n]), 9, (agg2/1000/60) + " min", Color.Yellow, yes);
plot BT3_Dot = if IsNaN(Close) then Double.NaN else 10;
BT3_Dot.SetPaintingStrategy(PaintingStrategy.Triangles);
BT3_Dot.SetLineWeight(TriSize);
BT3_Dot.AssignValueColor(if BT3 ==0 then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
AddChartBubble(!IsNaN(Close[n1]) and IsNaN(Close[n]), 10, (agg2/1000/60) + " min", Color.Yellow, yes);
plot BT4_Dot = if IsNaN(Close) then Double.NaN else 11;
BT4_Dot.SetPaintingStrategy(PaintingStrategy.Triangles);
BT4_Dot.SetLineWeight(TriSize);
BT4_Dot.AssignValueColor(if BT4 ==0 then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
AddChartBubble(!IsNaN(Close[n1]) and IsNaN(Close[n]), 11, (agg2/1000/60) + " min", Color.Yellow, yes);
plot BT5_Dot = if IsNaN(Close) then Double.NaN else 12;
BT5_Dot.SetPaintingStrategy(PaintingStrategy.Triangles);
BT5_Dot.SetLineWeight(TriSize);
BT5_Dot.AssignValueColor(if BT5 ==0 then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
AddChartBubble(!IsNaN(Close[n1]) and IsNaN(Close[n]), 12, (agg2/1000/60) + " min", Color.Yellow, yes);
def BTOT = (BT1+ BT2 + BT3+ BT4+ BT5);
plot BMTF_Dot = 13;
BMTF_Dot.SetPaintingStrategy(PaintingStrategy.SQUARES);
AMTF_Dot.SetLineWeight(SqSize);
BMTF_Dot.AssignValueColor ( if BTOT >2 then GlobalColor("BTrendUp") else GlobalColor("BTrendDown"));

#Aggregation 3 CT1
def O3 = Open(Period = AGG3);
def C3 = Close(Period =AGG3);
def H3 = High(Period = AGG3);
def L3 = Low(Period = AGG3);
def Cdata = Sum((O3+ C3)/2,6)/6;
def CT1 = if C3 >= Cdata then 1 else 0;
def CT2 = if C3[1] >= Cdata[1] then 1 else 0;
def CT3 = if C3[2] >= Cdata[2] then 1 else 0;
def CT4 = if C3[3] >= Cdata[3] then 1 else 0;
def CT5 = if C3[4] >= Cdata[4] then 1 else 0;
plot CT1_Dot = if IsNaN(Close) then Double.NaN else 15;
CT1_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
CT1_Dot.SetLineWeight(TriSize);
CT1_Dot.AssignValueColor(if CT1 ==0 then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
AddChartBubble(!IsNaN(Close[n1]) and IsNaN(Close[n]), 15, (agg3/1000/60) + " min", Color.Yellow, yes);
plot CT2_Dot = if IsNaN(Close) then Double.NaN else 16;
CT2_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
CT2_Dot.SetLineWeight(TriSize);
CT2_Dot.AssignValueColor(if CT2 ==0 then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
AddChartBubble(!IsNaN(Close[n1]) and IsNaN(Close[n]), 16, (agg3/1000/60) + " min", Color.Yellow, yes);
plot CT3_Dot = if IsNaN(Close) then Double.NaN else 17;
CT3_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
CT3_Dot.SetLineWeight(TriSize);
CT3_Dot.AssignValueColor(if CT3 ==0 then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
AddChartBubble(!IsNaN(Close[n1]) and IsNaN(Close[n]), 17, (agg3/1000/60) + " min", Color.Yellow, yes);
plot CT4_Dot = if IsNaN(Close) then Double.NaN else 18;
CT4_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
CT4_Dot.SetLineWeight(TriSize);
CT4_Dot.AssignValueColor(if CT4 ==0 then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
AddChartBubble(!IsNaN(Close[n1]) and IsNaN(Close[n]), 18, (agg3/1000/60) + " min", Color.Yellow, yes);
plot CT5_Dot = if IsNaN(Close) then Double.NaN else 19;
CT5_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
CT5_Dot.SetLineWeight(TriSize);
CT5_Dot.AssignValueColor(if CT5 ==0 then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
AddChartBubble(!IsNaN(Close[n1]) and IsNaN(Close[n]), 19, (agg3/1000/60) + " min", Color.Yellow, yes);
def CTOT = (CT1+ CT2 + CT3+ CT4+ CT5);
plot CMTF_Dot = 20;
CMTF_Dot.SetPaintingStrategy(PaintingStrategy.SQUARES);
CMTF_Dot.SetLineWeight(SqSize);
CMTF_Dot.AssignValueColor ( if CTOT>2 then GlobalColor("CTrendUp") else GlobalColor("CTrendDown"));

AssignPriceColor( if apc ==1 then if AT1 ==0 then GlobalColor("TrendDown") else GlobalColor("TrendUp") else if apc ==2 then if AT2 ==0 then GlobalColor("TrendDown") else GlobalColor("TrendUp") else if apc ==3 then if  AT3 ==0 then GlobalColor("TrendDown") else GlobalColor("TrendUp") else if apc ==4 then if AT4 ==0 then GlobalColor("TrendDown") else GlobalColor("TrendUp") else if apc ==5 then if AT5 ==0 then GlobalColor("TrendDown") else GlobalColor("TrendUp") else if apc ==6 then if ATOT <3 then GlobalColor("ATrendDown") else GlobalColor("ATrendUp") else if apc ==8 then if BT1 ==0 then GlobalColor("TrendDown") else GlobalColor("TrendUp") else if apc ==9 then if BT2 ==0 then GlobalColor("TrendDown") else GlobalColor("TrendUp") else if apc ==10 then if BT3 ==0 then GlobalColor("TrendDown") else GlobalColor("TrendUp") else if apc ==11 then if BT4 ==0 then GlobalColor("TrendDown") else GlobalColor("TrendUp") else if apc ==12 then if BT5 ==0 then GlobalColor("TrendDown") else GlobalColor("TrendUp") else if apc ==13 then if BTOT <3 then GlobalColor("BTrendDown") else GlobalColor("BTrendUp") else if apc ==15 then if CT1 ==0 then GlobalColor("TrendDown") else GlobalColor("TrendUp") else if apc ==16 then if CT2 ==0 then GlobalColor("TrendDown") else GlobalColor("TrendUp") else if apc ==17 then if CT3 ==0 then GlobalColor("TrendDown") else GlobalColor("TrendUp") else if apc ==18 then if CT4 ==0 then GlobalColor("TrendDown") else GlobalColor("TrendUp") else if apc ==19 then if CT5 ==0 then GlobalColor("TrendDown") else GlobalColor("TrendUp") else if apc ==20 then if CTOT <3 then GlobalColor("CTrendDown") else GlobalColor("CTrendUp") else Color.CURRENT);
 
Last edited:

David45

Member
2019 Donor
Does anyone know how to change or add to the code for this indicator so that when bullish, the candlesticks paint Dark_Green instead of the default Blue?

Thanks in advance!
 

BenTen

Administrative
Staff
VIP
@David45 You can change it directly in the original indicator's settings page.

XaWqQjS.png
 

David45

Member
2019 Donor
@BenTen Wow I feel stupid! I had no idea you could change these colors under Globals. Thanks so much for pointing this out to me BenTen!
 

Slippage

Active member
@Cmeeker778 That PDF looks ancient given it's still advertising tradethemarkets.com, which is Carter's old company.

TTM_Squeeze is built into ThinkOrSwim and hasn't changed since back then. There's a newer Pro version you can pay for but it's not necessarily better and you can get imitations of that indicator on this site for free.

The "anchor" concept in that PDF, using higher timeframes the way he described back then, has been replaced with using TTM_Wave instead which does that work for you and is also built into ThinkOrSwim for free.

Basically, you are looking at an obsolete version of his squeeze strategy. You can get his book Mastering the Trade which has a chapter dedicated to this strategy and was updated/revised in 2019. It also gives resources such as https://www.simplertrading.com/squeeze/ Looking at the list of contents on the left of these videos, Chapter 11 Squeeze, Chapter 12 Wave and Chapter 13 TTM_Trend in the book are all combined into a single strategy.
 

Cmeeker778

New member
@Slippage Thank you! Good to get an answer on this, I’ve been searching everywhere. I still like the concept of painted bars to filter out trades not in line with the HTF trends. Any ideas where I could get an indicator like that?
 

Similar threads

Top