In his article in this issue, “(Yet Another) Improved RSI,” John Ehlers explains how he enhances the RSI by taking advantage of Hann windowing. The RSIH indicator provides a smoother calculation than the classic RSI and has a zero mean. The inherent smoothing in the computation removes the need for supplemental filtering. The best length to use for the RSIH is described to be one that is on the order of the dominant cycle period in the data.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
//Indicator: TASC DEC 2021 RSIH // TASC JAN 2022 // RSIH - RSI with Hann Windowing // (C) 2005-2021 John F. Ehlers // Parameters RSILength: 14 // Accumulate "Closes Up" and "Closes Down" CU = 0 CD = 0 for count = 1 to RSILength do if Close[count - 1] - Close[count] > 0 then CU = CU + (1 - cos(360*count / (RSILength + 1))) * (Close[count - 1] - Close[count]) endif if Close[count] - Close[count - 1] > 0 then CD = CD + (1 - cos(360*count / (RSILength + 1))) *(Close[count] - Close[count - 1]) endif next if CU + CD <> 0 then MyRSI = (CU - CD) / (CU + CD) endif return MyRSI as "RSIH" |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials