fxDreema

    • Register
    • Login
    • Search
    • Back to the main page
    • Categories
    • Recent
    • Tags
    • Popular
    • Search

    Quick Average Daily Range

    Questions & Answers
    2
    3
    654
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      daedalus last edited by

      Hey guys just trying to build a simple Average Daily Range calculation into an array that I can access. Can you check what i've built and see if there is a more efficient way to do this? I'm not great at coding but i've tried to place a for loop to build out the absolute values of the H/L calculation: ABS(High[i]-Low[i]) so i can store the daily ranges over the past days. But i'm running into issues actually calculating the average of those values and getting some Array out of range errors.

      https://fxdreema.com/shared/bOxV5GF1c

      I know the math behind what i'm trying to build but I obviously don't have the second loop correct in some fashion.

      ADR = (DR[1] + DR[2] + DR[3] + DR[4] + DR[5]) / Days_To_Avg

      I'm getting stuck in adding them all together before I average them I think.

      Also, how can I call the value of the DR array in a condition block? Do i need to do another block to modify a new variable before I can compare it in a condition? (I'm not aware of a way to call a value of an array in the condition block?

      1 Reply Last reply Reply Quote 0
      • V
        vnpython 0 last edited by

        why not use ATR? and put period of 6? and get yesterday's value?

        1 Reply Last reply Reply Quote 0
        • D
          daedalus last edited by

          You're absolutely correct that would be a way easier way to do it. Thanks for the input - i'll go that route instead.

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post

          Online Users

          K
          R
          N
          W
          L
          E
          N
          A
          H
          H
          O
          R
          S

          22
          Online

          146.7k
          Users

          22.4k
          Topics

          122.6k
          Posts

          Powered by NodeBB Forums | Contributors