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

MTF Bollinger Bands Updated for ThinkorSwim

Jim C

New member
Hey All,

I grabbed a MTF Bollinger Band from here and after testing realized the calculations were incorrect. If you placed the indicator for a daily over the ToS indicator with the same settings the plots were completely different. I have since made adjustments to the ToS indicator to be able to plot under lower time frames. You cannot plot a smaller aggregation period on higher time frames though. Hope this helps! JC

Code:
#MTF_BollingerBands

#Jim Coppersmith

#V1.1

#1-26-20

input price = close;
input displace = 0;
input length = 20;
input Num_Dev_Dn = -2.0;
input Num_Dev_up = 2.0;
input averageType = AverageType.Simple;
input timeframe = AggregationPeriod.DAY;

def sDev = stdev(data = close(period= timeframe) [-displace], length = length);

plot MidLine = MovingAverage(averageType, data = close (period=timeframe)[-displace], length = length);
plot LowerBand = MidLine + num_Dev_Dn * sDev;
plot UpperBand = MidLine + num_Dev_Up * sDev;

LowerBand.SetDefaultColor(GetColor(0));
MidLine.SetDefaultColor(GetColor(1));
UpperBand.SetDefaultColor(GetColor(5));

2egjv5g.png


Cf1Vn42.png
 
Last edited by a moderator:

Similar threads

Top