In a recent update (rel-10-29-2022), ThinkorSwim added the Relative Strength Index Hann (RSIH) indicator to its platform.
The Relative Strength Index Hann (RSIH), created by John Ehlers, is a technical analysis indicator based on the Relative Strength Index (RSI).
The RSIH helps to solve some of the limitations of the RSI. These include normalizing the output, incorporating Hann window to filter results, and ignoring oversold and overbought conditions when looking for a buy/sell trigger.
Relative Strength Index Hann for ThinkorSwim
#
# TD Ameritrade IP Company, Inc. (c) 2022
#
declare lower;
input price = close;
input length = 14;
def NetChgAvg = reference FIR_Hann(price = price - price[1], length = length);
def TotChgAvg = reference FIR_Hann(price = AbsValue(price - price[1]), length = length);
plot RSIH = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;
plot ZeroLine = 0;
RSIH.SetDefaultColor(GetColor(4));
ZeroLine.SetDefaultColor(GetColor(7));
Below you will find the modified version of the RSIH indicator. The plot now changes color based on the condition below.
- RSIH > 0 = Green
- RSIH < 0 = Red
# RSIH
# 10/29/2022
# Melvin C.
# Added color change to plot
declare lower;
input price = close;
input length = 14;
def NetChgAvg = reference FIR_Hann(price = price - price[1], length = length);
def TotChgAvg = reference FIR_Hann(price = AbsValue(price - price[1]), length = length);
plot RSIH = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;
plot ZeroLine = 0;
RSIH.AssignValueColor(if RSIH > 0 then Color.GREEN else Color.RED);
ZeroLine.SetDefaultColor(GetColor(7));