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


#Jim Coppersmith



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;



Last edited by a moderator:


New member
@Jim C This is awesome. Thank you! Assuming one could make this work for Tick charts? i.e. instead of selecting the time frame as an input, selecting a tick size. E.g. I would like to show the 1500 Tick Aggregation Period Bollinger on a 150 Tick chart. Please let me know if you have any ideas. :)
Last edited:

Similar threads