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 kaywai, 09-01-2023, 08:44 PM
      4 responses
      593 views
      0 likes
      Last Post joselube001  
      Started by dpolyakov, 03-29-2024, 11:30 AM
      3 responses
      129 views
      2 likes
      Last Post sonia0101  
      Started by algospoke, 04-17-2024, 06:40 PM
      4 responses
      35 views
      0 likes
      Last Post algospoke  
      Started by RideMe, 04-07-2024, 04:54 PM
      4 responses
      22 views
      0 likes
      Last Post RideMe
      by RideMe
       
      Started by cre8able, 04-17-2024, 04:16 PM
      6 responses
      54 views
      0 likes
      Last Post cre8able  
      Working...
      X