Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

RSI indicator value

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    RSI indicator value

    Hi,

    I used RSI indicator in my strategy.I calculate RSI values on a daily bar.RSI indicator started calculation after 20 bars complete.Is it possible to calculate values before 20 bars? For example after 2 or 3 daily bars it shows values on the chart.

    Thanks,
    Irfan

    #2
    Hi Rana.irfan,

    Thank you for your post.

    You will need to create a new script with the same code as the RSI and input BarRequired in the Initialize section of the code.

    To create a new RSI -
    • Tools -> Edit NinjaScript -> Indicator -> RSI
    • Right click in the code editor and select Save As...
    • Give the new indicator a name
    • Click Ok


    Input in the Initialize section of the code BarsRequired = Value.

    Replace value with a number of your choice.

    Below is a link on the the BarsRequired,
    http://www.ninjatrader.com/support/h...rsrequired.htm

    Let me know if I can be of further assistance.
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by rana.irfan View Post
      Hi,

      I used RSI indicator in my strategy.I calculate RSI values on a daily bar.RSI indicator started calculation after 20 bars complete.Is it possible to calculate values before 20 bars? For example after 2 or 3 daily bars it shows values on the chart.

      Thanks,
      Irfan

      NinjaTrader does not display values for the first 20 bars by default. This is not really a good solution because the training period - this is the period required before the indicator produces exact results - can be longer or shorter.

      For example:

      A SMA(14) will show an exact value after 14 bars, so you could change BarsRequired and set it to 14. An EMA(14) will probably take between 30 and 40 bars, before it shows an exact value. The reason is that the EMA uses the prior bar's EMA to calculate the current bar's EMA. As the prior bar's EMA was erroneuos, the current bar's EMA will be also false. As only a fraction of the error is transmitted, the EMA slowly becomes more and more accurate. But it takes a longer time than the SMA. All IIRs (infinite impulse response filter) have a longer training period. FIRs (finite impulse response filters) like the SMA have a defined training period.

      But your question was about the RSI. Let us assume that you use a RSI(14,3).The RSI - developed by Welles Wilder - uses exponential smoothing to calculate the average upmoves and downmoves, therefore it behaves as a IIR filter. The same is true for the second plot of the RSI, which is an exponential moving average of the first plot.

      Therefore the RSI(14,3) has a training period of at least 30 - 40 bars, and you gain nothing, if you display the false values that are calculated for the first 20 bars!
      Last edited by Harry; 09-24-2013, 02:44 AM.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by elirion, Today, 01:36 AM
      0 responses
      0 views
      0 likes
      Last Post elirion
      by elirion
       
      Started by gentlebenthebear, Today, 01:30 AM
      0 responses
      2 views
      0 likes
      Last Post gentlebenthebear  
      Started by samish18, Yesterday, 08:31 AM
      2 responses
      9 views
      0 likes
      Last Post elirion
      by elirion
       
      Started by Mestor, 03-10-2023, 01:50 AM
      16 responses
      389 views
      0 likes
      Last Post z.franck  
      Started by rtwave, 04-12-2024, 09:30 AM
      4 responses
      31 views
      0 likes
      Last Post rtwave
      by rtwave
       
      Working...
      X