I use StochRSI indicator a lot in Ninjatrader, however It only display %K line.
I would like it to also display the %D line; StochRSI %D is a moving average of %K over %D Length bars.
I came up with some code by adding D as SMA of StochRSI but it doesn't show the correct results, the D line is way off. can someone help? can I just modify stochRSI.cs and get it done? if so what code should I add and where.
Indicator below includes the D signal line. I have also enhanced the original period of the indicator . You can now select a different period for the RSI and the Stochastics K line. If you use the same period for both, the modified indicator displays the same results as the original indicator.
Now, I have to make some reserves. There are about 10 different versions of RSI and Stoch supplied by various charting packages. Some packages use the close, others the typical price to calculate the Stochastics. For smoothing I have seen simple, exponential and weighted smoothing, so you will not necessarily find exactly the same results as with other charting packages.
I intend to start a thread to explain all those different versions of these two indicators and how to use them, but it is not for now.
The following 12 users say Thank You to Fat Tails for this post:
I have reworked the Stochastic RSI. Please disregard the four year old version from post #3.
The new version comes with the following enhancements, when compared to the NinjaTrader default indicator.
- The NinjaTrader default indicator calculates a raw Stochastics directly from the RSI, which is used as an input series. No further smoothing is possible. The enhanced version allows further smoothing of the raw K line. The default period for the K line smoothing is set to 1 (no smoothing).
- The indicator comes with a D line added. The D line is calculated as a SMA of the K line and can be used as signal line.
- The NinjaTrader default version uses the same lookback period for the RSI and the Stochastics. This is in line with the suggestions by Tushar Chande and Stanley Kroll. However, this version allows to select different periods for RSI and Stochastics.
- Code efficiency is improved, which results in a reduced CPU load, when the indicator is set to COBC = false.