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

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:

visag9

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

Top