Can anyone help is changing this indicator with color? Its called True Strength Index. Its a built in indicator for TOS.
I would like True Strength Index colors to be:
I would like True Strength Index colors to be:
- Green is its moving upward above zero line
- red if it moving downward below zero line
- yellow color if it moving from negative value to positive value under zero line.
- Purple color if it moving positive value to negative value above zero line.
Code:
#
# TD Ameritrade IP Company, Inc. (c) 2007-2021
#
declare lower;
input longLength = 25;
input shortLength = 13;
input signalLength = 8;
input averageType = AverageType.EXPONENTIAL;
def diff = close - close[1];
def doubleSmoothedAbsDiff = MovingAverage(averageType, MovingAverage(averageType, AbsValue(diff), longLength), shortLength);
plot TSI;
plot Signal;
TSI = if doubleSmoothedAbsDiff == 0 then 0
else 100 * (MovingAverage(averageType, MovingAverage(averageType, diff, longLength), shortLength)) / doubleSmoothedAbsDiff;
Signal = MovingAverage(averageType, TSI, signalLength);
plot ZeroLine = 0;
TSI.SetDefaultColor(GetColor(1));
Signal.SetDefaultColor(GetColor(8));
Signal.hide();
ZeroLine.SetDefaultColor(GetColor(5));
Last edited: