Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ADX indicator not providing public access to data

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

    ADX indicator not providing public access to data

    I am working on a strategy that I would like to incorporate data from the ADX/DMI indicators. I notice that neither the the ADX or DM indicators provide this data in public variables. Before I start down the path of creating yet another ADX indicator, is there any reason why these data elements are not available for this purpose?

    #2
    Hi,

    You should have no problem accessing ADX values.

    Code:
    double value = ADX(20)[0];
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      If I understand correctly, I should be able to do something like:

      ADX myADX = ADX(14);
      DM myDM = DM(14);

      if (myADX > myDM.DiPlus) { do something

      ??

      My conclusion came from looking at variables exposed by DM. Seems that also exposing Tr would make this a bit cleaner.

      Comment


        #4
        I do not know if that will work. General practice for calling indicators is just to do ADX(14). To get the value you would do ADX(14)[0]. To get DM values you can use DM(14)[0], DM(14).DiPlus[0], or DM(14).DiMinus[0].


        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Hi Josh,

          Tried

          Code:
          double myADX = ADX(20)[0];
          print (myADX);
          but got this error message :

          "Operator '>=;Cannot be applied to operands of type 'NinjaTrader.Indicator.ADX' and 'int'"

          There is no single operator >= in my code ...

          I am trying to print the current ADX value and also have tried


          Code:
          double myADX = ADX(20);
          print (myADX);
          but it doesn't work too.






          Originally posted by NinjaTrader_Josh View Post
          Hi,

          You should have no problem accessing ADX values.

          Code:
          double value = ADX(20)[0];

          Comment


            #6
            double myADX = ADX(20)[0];
            Print(myADX.ToString());
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              You are the man !. I have another problem , seems to be unable to access the ADX value


              double myADX = ADX(14)[0];

              if myADX >= 25 then
              {
              statement .....
              }


              got this error message again:

              "Operator '>=;Cannot be applied to operands of type 'NinjaTrader.Indicator.ADX' and 'int'"

              Comment


                #8
                Your myADX is a double, which you can't compare straight to an integer, try 25.00 in your code.
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by cowcool View Post
                  You are the man !. I have another problem , seems to be unable to access the ADX value


                  double myADX = ADX(14)[0];

                  if myADX >= 25 then
                  {
                  statement .....
                  }


                  got this error message again:

                  "Operator '>=;Cannot be applied to operands of type 'NinjaTrader.Indicator.ADX' and 'int'"
                  if(ADX(14)[0] >= 25)
                  {
                  //do your stuff
                  }

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by RookieTrader, Today, 09:37 AM
                  3 responses
                  15 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by kulwinder73, Today, 10:31 AM
                  0 responses
                  5 views
                  0 likes
                  Last Post kulwinder73  
                  Started by terofs, Yesterday, 04:18 PM
                  1 response
                  23 views
                  0 likes
                  Last Post terofs
                  by terofs
                   
                  Started by CommonWhale, Today, 09:55 AM
                  1 response
                  4 views
                  0 likes
                  Last Post NinjaTrader_Erick  
                  Started by Gerik, Today, 09:40 AM
                  2 responses
                  7 views
                  0 likes
                  Last Post Gerik
                  by Gerik
                   
                  Working...
                  X