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

Current value of a XXX (int) period ADX using high price type

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

    Current value of a XXX (int) period ADX using high price type

    Hello!

    I am trying to get the the current vlues of x period ADX using high and low price types. For this ppurpuse I have used a loop.

    for int ( i = 100; i >= 0; i--)
    {
    double val1 = ADX(High, ADXbars)[i - 1];
    double val2 = ADX(Low, ADXbars)[i - 1];
    }


    I have seen at output that val1 and val2 are identic. For each incrementation I obtain for given position "i" the same value for val1 and val2, But I am wondering why both values are identic.
    In the documentation we have: double value = ADX(High, 20)[0]; meaning the current value of a 20 period ADX using high price type.
    My val1 should be therefore the value at position [i -1] of ADXBars (int) period using high price type, while val2 represents the value at position [i -1] of ADXBars (int) period using Low price type.
    What is wrong in my calculation so that val1 and val2 are identic?

    Thanks!

    #2
    Hello Stanfillirenfro,

    I see the sample that you are referring to, I went ahead and reported the inconsistency. Not all indicators take an input which the ADX is one that does not take input.

    You would need to make a custom ADX for that type of comparison and use Input in the ADX logic. In your demonstration it will be using the series which called the ADX indicator and its OHLC values, in that use those would be the same values.



    I have attached a sample of one way to use input in the ADX, you can of course modify the script further as needed for your use cases.



    I look forward to being of further assistance.
    Attached Files
    JesseNinjaTrader Customer Service

    Comment


      #3
      Many thanks Jesse for your reply.

      I will revert to you after going through your advices.

      Thanks!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by geddyisodin, Today, 05:20 AM
      5 responses
      32 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by bmartz, Today, 09:30 AM
      2 responses
      12 views
      0 likes
      Last Post bltdavid  
      Started by f.saeidi, Today, 11:02 AM
      1 response
      4 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by geotrades1, Today, 10:02 AM
      4 responses
      12 views
      0 likes
      Last Post geotrades1  
      Started by rajendrasubedi2023, Today, 09:50 AM
      3 responses
      16 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Working...
      X