• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

StdDev code help please

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

    StdDev code help please

    Please help me understand why my StdDev code is incorrect for Value2.

    Code:
    private int lengthFast = 5; // Default setting for LengthFast
    int barsback = 500; //look back period
    int Var3 = -0.50; // -0.50 deviation
    double Var18 = TRIX(Var1, LengthFast).Default[0];
    double Var22 = 1;
    Value2 = Var3 * StdDev(Var18, barsBack, Var22);

    #2
    Hello,

    Can you please tell me what value you are getting, and what value you are expecting?
    Dave I.NinjaTrader Product Management

    Comment


      #3
      i shoud get -0.19, but I cannot get Ninjatrader code to verify.

      Comment


        #4
        Thank you. It looks like we're missing a value for Var1. Can you please tell me what the value should be for that variable?
        Dave I.NinjaTrader Product Management

        Comment


          #5
          Originally posted by tradethebonds View Post
          Please help me understand why my StdDev code is incorrect for Value2.

          Code:
          private int lengthFast = 5; // Default setting for LengthFast
          int barsback = 500; //look back period
          int Var3 = -0.50; // -0.50 deviation
          double Var18 = TRIX(Var1, LengthFast).Default[0];
          double Var22 = 1;
          Value2 = Var3 * StdDev(Var18, barsBack, Var22);
          You cannot take the StdDev of a single double (pun intended ).
          Last edited by koganam; 04-10-2015, 11:08 AM.

          Comment


            #6
            Sorry...about that...

            Var1 = EMA(EMA(( 3.14159155 * ( OPEN[0] + CLOSE[0] + HIGH[0] + LOW[0] )) / 4, 2), 5);

            Comment


              #7
              Hello,

              Thank you for clarifying that. I'm running into another snag attempting to test the code. It appears that you are not passing in the correct parameters for the StdDev() indicator method. Can you please take a look at the help guide article below and advise me what you would like to pass in (either a period only, or a data series and a period)?

              http://www.ninjatrader.com/support/h...ion_stddev.htm

              I look forward to your reply.
              Dave I.NinjaTrader Product Management

              Comment


                #8
                Since it will be updating on each new bar, a data series and a period please.

                Comment


                  #9
                  Sounds good -- can you tell me what you would like to use as the data series and period?
                  Dave I.NinjaTrader Product Management

                  Comment


                    #10
                    Var1 would be the data series and a period of 500 bars back please, thanks very much!
                    Last edited by tradethebonds; 04-13-2015, 06:36 AM.

                    Comment


                      #11
                      Hello,

                      According to your previous post, it looks like Var1 is going to be a double:

                      Code:
                      Var1 = EMA(EMA(( 3.14159155 * ( OPEN[0] + CLOSE[0] + HIGH[0] + LOW[0] )) / 4, 2), 5);
                      You will need to rework your code to set up a data series to pass into the StdDev() method. For more information on the difference between native types and data series, please see the help guide articles below:

                      http://www.ninjatrader.com/support/h...ries_class.htm

                      http://www.ninjatrader.com/support/h...sic_syntax.htm

                      Please let know if I can assist further.
                      Dave I.NinjaTrader Product Management

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by gurdonzn, Today, 12:36 PM
                      0 responses
                      5 views
                      0 likes
                      Last Post gurdonzn  
                      Started by swcooke, Yesterday, 11:18 AM
                      5 responses
                      24 views
                      0 likes
                      Last Post NinjaTrader_Jesse  
                      Started by Lisa Marshall, 01-25-2020, 04:11 PM
                      1 response
                      18 views
                      0 likes
                      Last Post NinjaTrader_Jim  
                      Started by utilizator, 01-25-2020, 11:36 AM
                      4 responses
                      35 views
                      0 likes
                      Last Post utilizator  
                      Started by Aporshnev, Today, 08:46 AM
                      2 responses
                      18 views
                      0 likes
                      Last Post Aporshnev  
                      Working...
                      X