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 Brevo, Today, 01:45 AM
                  0 responses
                  3 views
                  0 likes
                  Last Post Brevo
                  by Brevo
                   
                  Started by aussugardefender, Today, 01:07 AM
                  0 responses
                  3 views
                  0 likes
                  Last Post aussugardefender  
                  Started by pvincent, 06-23-2022, 12:53 PM
                  14 responses
                  239 views
                  0 likes
                  Last Post Nyman
                  by Nyman
                   
                  Started by TraderG23, 12-08-2023, 07:56 AM
                  9 responses
                  384 views
                  1 like
                  Last Post Gavini
                  by Gavini
                   
                  Started by oviejo, Today, 12:28 AM
                  0 responses
                  6 views
                  0 likes
                  Last Post oviejo
                  by oviejo
                   
                  Working...
                  X