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 Tim-c, Today, 02:10 PM
      1 response
      7 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by Taddypole, Today, 02:47 PM
      0 responses
      2 views
      0 likes
      Last Post Taddypole  
      Started by chbruno, 04-24-2024, 04:10 PM
      4 responses
      50 views
      0 likes
      Last Post chbruno
      by chbruno
       
      Started by TraderG23, 12-08-2023, 07:56 AM
      10 responses
      400 views
      1 like
      Last Post beobast
      by beobast
       
      Started by lorem, Yesterday, 09:18 AM
      5 responses
      25 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X