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

RVI formula?

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

    RVI formula?

    Hi,
    I've got a question regarding how NinjaTrader calculates the RVI. I would like to do some additional

    research in excel. I assume the following:
    1) RVI=StdDev(RSI)

    2) RSI= 100 – 100 / ( 1 + RS )
    RS = Relative Strength = AvgU / AvgD
    AvgU = average of all up moves in the last N price bars
    AvgD = average of all down moves in the last N price bars
    N = the period of RSI

    3) Averaging the Advances and Declines
    When calculating the advances and declines. Do NinjaTrader uses the Simple Moving Average or the EMA?
    Formulas for SMA:
    AvgU = sum of all up moves (U) in the last N bars divided by N
    AvgD = sum of all down moves (D) in the last N bars divided by N
    N = RSI period

    Are these formulas correct or differs NinjaTradres' RVI calculation from that?
    Maybe you can state the RVI-formulas (RSI and StDev) which NinjaTrader uses?

    Thank you very much and have a nice weekend
    Stefan

    #2
    Welcome to our forums here Stefan, the codes of RVI, RSI and StDev are all accessible through our NinjaScript editor for you, they are not protected from viewing in any way.

    For the averages, an SMA weighting would be used.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Bertrand View Post
      Welcome to our forums here Stefan, the codes of RVI, RSI and StDev are all accessible through our NinjaScript editor for you, they are not protected from viewing in any way.

      For the averages, an SMA weighting would be used.
      Hi Bertrand,
      Thank you very much for your quick help.
      Best wishes
      Stefan

      Comment


        #4
        RVI Indicator Calcuation

        Hi,
        I've got another question regarding how the RVI is calculated. We've developed an own indicator (SentiTrade6min; green line). When I'am want to determine the RVI of our indicator one can see, that the RVI of our indicator (yellow line) moves only when SentiTrade6minutes is moving.

        Is there any "hidden" momentum calculation in the RVI? In the RVI formula I can't find one.Click image for larger version

Name:	RVI_Chart_2014-04-08.png
Views:	1
Size:	76.1 KB
ID:	870173

        Thank you very much and best wishes
        Stefan

        Comment


          #5
          Hi kstefan,

          Im not quite sure what you are asking when you refer to momentum.
          Could you clarify this for me?

          Also, if your indicator is plotting what is returned from the RVI indicator, it would be expected that these would be exactly the same.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            RVI Indicator Calcuation

            Hi Chelsea,
            Thanks for your help. I would like to reengineer the RVI calcalation in Excel (see screenshot). As you can see, in the yellow RVI-column there are some errors. From calculation logic that is OK. But NinjaTrader deals with this problem very satisfactorily by drawing a new RVI/sentitrade6minunutes-value only when the sentitrade6min-indicator moves (up or down). As a result, I need a kind of (momentum?)-filter, like NinjaTrader. I couldn't find any additional code in the RVI-indicator script.
            Do you have an idea, how NinjaTrader solved that?

            Thanks a lot
            Stefan



            Originally posted by NinjaTrader_ChelseaB View Post
            Hi kstefan,

            Im not quite sure what you are asking when you refer to momentum.
            Could you clarify this for me?

            Also, if your indicator is plotting what is returned from the RVI indicator, it would be expected that these would be exactly the same.
            Attached Files

            Comment


              #7
              Hi kstefan,

              There is not any hidden code for the RVI indicator.

              The rvi value that is set at the end of OnBarUpdate is calculated with the code you see in the script.

              The only bits that are not directly in this script, are the StdDev (standard deviation) calls. These values (up / dn) come from the StdDev indicator.

              You can print the values on each step to see what they are being calculated as so that you know you are using each step of math in the script.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Hi Chelsea,
                Thanks a lot. How can I print the values on each step? Could you please state the steps to get there?

                Thank you very much and best wishes
                Stefan

                Comment


                  #9
                  Hello kstefan,

                  Start by making a copy of the RVI indicator so that you can modify the copy.
                  Right-click the NinjaScript Editor -> select Save As... -> give the copy a new unique name -> click OK

                  Then on each step add a new print call. For example:

                  if (High[0] > High[1])
                  up = StdDev(High, 10)[0];
                  Print(up);

                  if (High[0] < High[1])
                  dn = StdDev(High, 10)[0];
                  Print(dn);

                  double actUpAvgH = lastUpAvgH = (upAvgH * (Period - 1) + up) / Period;
                  Print(actUpAvgH);

                  The prints will go to the Output Window. (Tools -> Output Window...)

                  Below is a link to the help guide on Print().
                  http://www.ninjatrader.com/support/h.../nt7/print.htm
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    Hi Chelsea,
                    Thanks again for your super-help!
                    Best wishes
                    Stefan

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by helpwanted, Today, 03:06 AM
                    1 response
                    7 views
                    0 likes
                    Last Post sarafuenonly123  
                    Started by Brevo, Today, 01:45 AM
                    0 responses
                    7 views
                    0 likes
                    Last Post Brevo
                    by Brevo
                     
                    Started by aussugardefender, Today, 01:07 AM
                    0 responses
                    5 views
                    0 likes
                    Last Post aussugardefender  
                    Started by pvincent, 06-23-2022, 12:53 PM
                    14 responses
                    242 views
                    0 likes
                    Last Post Nyman
                    by Nyman
                     
                    Started by TraderG23, 12-08-2023, 07:56 AM
                    9 responses
                    385 views
                    1 like
                    Last Post Gavini
                    by Gavini
                     
                    Working...
                    X