NexusFi: Find Your Edge


Home Menu

 





Need simple code for StochRSI please


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Fat Tails with 3 posts (24 thanks)
    2. looks_two mrback with 1 posts (0 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 TraderTom with 1 posts (0 thanks)
    1. trending_up 7,311 views
    2. thumb_up 24 thanks given
    3. group 4 followers
    1. forum 5 posts
    2. attach_file 2 attachments




 
Search this Thread
  #1 (permalink)
TraderTom
USA
 
Posts: 1 since Sep 2010
Thanks Given: 1
Thanks Received: 0

Hello there,
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.

Thank you for your assistance
Tom


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NYSE Owner ICE Invests in Crypto Exchange OKX at $25 Bil …
Cryptocurrency
Orban at 29pct as Hungary Votes Tomorrow -- McIlroy Surg …
Prediction Markets & Event Contracts
April 2026 Jobs Report: +115k vs +65k Expected
Traders Hideout
Saylors 41-Month HODL Breaks: Strategy Sells 32 BTC as $ …
Prediction Markets & Event Contracts
Iran Peace Expired NO: Ceasefire on Life Support, OPEC a …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
24 thanks
2026 Jlab journal
10 thanks
Lady Vols Primer: Trading Volatility Journal
8 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Trying to learn Volume and price action correlation
5 thanks
  #3 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader
Broker: Interactive Brokers
Trading: Futures & Stocks
Posts: 9,887 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,114



TraderTom View Post
Hello there,
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.

Thank you for your assistance
Tom

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.


Attached Files
Elite Membership required to download: anaStochRSI.zip
Reply With Quote
  #4 (permalink)
mrback
Vancouver Canada
 
Posts: 1 since Feb 2013
Thanks Given: 1
Thanks Received: 0

Hi There
Thank you very much for having posted the stochastic RSI code for Ninja
Where do I need to download it in order to use it and would it work with the new version of Ninja?
Thank you


Reply With Quote
  #5 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader
Broker: Interactive Brokers
Trading: Futures & Stocks
Posts: 9,887 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,114


mrback View Post
Hi There
Thank you very much for having posted the stochastic RSI code for Ninja
Where do I need to download it in order to use it and would it work with the new version of Ninja?
Thank you

@mrback: You can download the attachment from the post above. The indicator works with NinjaTrader 7, which is the latest version.


Reply With Quote
Thanked by:
  #6 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader
Broker: Interactive Brokers
Trading: Futures & Stocks
Posts: 9,887 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,114

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.

Download link:

https://nexusfi.com/download/ninjatrader-7/indicators/1552-download.html?view



Reply With Quote




Last Updated on May 6, 2014


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts