#
# TD Ameritrade IP Company, Inc. (c) 2008-2021
#
declare lower;
input longLength = 2;
input shortLength = 10;
input signalLength = 26;
input averageType = AverageType.EXPONENTIAL;
input nDEV = 21;
input N_AVE = 21;
plot ErgodicOsc = TrueStrengthIndex(longLength, shortLength, signalLength, averageType).TSI - TrueStrengthIndex(longLength, shortLength, signalLength, averageType).Signal;
plot ZeroLine = 0;
ErgodicOsc.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
ErgodicOsc.SetLineWeight(3);
ErgodicOsc.DefineColor("Positive", Color.UPTICK);
ErgodicOsc.DefineColor("Negative", Color.DOWNTICK);
ErgodicOsc.AssignValueColor(if ErgodicOsc >= 0 then ErgodicOsc.Color("Positive") else ErgodicOsc.Color("Negative"));
ZeroLine.SetDefaultColor(GetColor(7));
def deVS = StDev(ErgodicOsc, NDEV );
def AVERAGE = Average(ErgodicOsc, N_AVE);
plot UPPER = AVERAGE + 2 * deVS;
plot LOWER = AVERAGE - 2 * deVS;