Announcement

Collapse
No announcement yet.

how is ATR calculated in esignal?

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

  • how is ATR calculated in esignal?

    this is very close
    PHP Code:
    var Temp 0;
    var 
    i=0;
    for (
    i=-100;i<=0;i++) Temp Temp + (high(i) - low(i))
    return 
    String(Temp 100
    but not quite, even rounding the value off or just the integer value dont match the calculation given by esignal, its close but not quite, so i was wondering, how does esignal calculate the atr?
    Last edited by kalzenith; 09-28-2009, 04:24 PM.

  • #2
    Re: how is ATR calculated in esignal?

    kalzenith
    You can see the logic in the atr.efs which is in the Library folder of Formulas
    Alex


    Originally posted by kalzenith
    this is very close
    PHP Code:
    var Temp 0;
    var 
    i=0;
    for (
    i=-100;i<=0;i++) Temp Temp + (high(i) - low(i))
    return 
    String(Temp 100
    but not quite, even rounding the value off or just the integer value dont match the calculation given by esignal, its close but not quite, so i was wondering, how does esignal calculate the atr?

    Comment


    • #3
      ive been through it, and i understand now that it takes the higher value between Math.abs(high()-low()), Math.abs(close(-1)-low()), and Math.abs(close(-1)-high()), but i still cant seem to get my program to mimic the calculation.. i realize my script is less efficient than it needs to be, but it should do the job, i dont understand why it isnt

      PHP Code:
      var Length 5;
      var 
      Temp 0;
      for (var 
      i=Math.abs(Length-1)*-1;i<=0;i++) Temp Temp Math.max(Math.abs(high(i)-low(i)), Math.abs(close(i-1)-low(i)), Math.abs(close(i-1)-high(i)))
      return 
      Temp/Length 

      Comment


      • #4
        -

        kalzenith
        See my reply to the same question you asked in this thread
        Alex


        Originally posted by kalzenith
        ive been through it, and i understand now that it takes the higher value between Math.abs(high()-low()), Math.abs(close(-1)-low()), and Math.abs(close(-1)-high()), but i still cant seem to get my program to mimic the calculation.. i realize my script is less efficient than it needs to be, but it should do the job, i dont understand why it isnt

        PHP Code:
        var Length 5;
        var 
        Temp 0;
        for (var 
        i=Math.abs(Length-1)*-1;i<=0;i++) Temp Temp Math.max(Math.abs(high(i)-low(i)), Math.abs(close(i-1)-low(i)), Math.abs(close(i-1)-high(i)))
        return 
        Temp/Length 

        Comment


        • #5
          thanks, yeah i know i asked the question before, i just didnt think to look for it because i didnt understand the answer at the time, i believe ive figured it out this time though, thanks.
          PHP Code:
          var Length 100;
          var 
          Temp 0;
          if (
          Previous == null) {
              for (var 
          i=Math.abs(Length-1)*-1;i<=0;i++) Temp Temp Math.max(Math.abs(high(i)-low(i)), Math.abs(close(i-1)-low(i)), Math.abs(close(i-1)-high(i)))
              
          Previous = (Temp/Length)
          } else 
          Previous = (Previous*(Length-1)+Math.max(Math.abs(high()-low()), Math.abs(close(-1)-low()), Math.abs(close(-1)-high())))/Length
          return Previous 
          Last edited by kalzenith; 09-30-2009, 09:20 AM.

          Comment

          Working...
          X