Announcement

Collapse
No announcement yet.

Formula for Directional Indicators

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

  • Formula for Directional Indicators

    I have a rather technical question, so I hope this is in the right place....

    I was wondering if anyone knows how QCharts calculates the average (over some period) of the directional indicators. I am trying to verify QCharts' values in my own code and I cannot match theirs. I can find Average True Range and Directional Indicators for a period of one, and actually I can find Average True Range for all periods and match the QCharts numbers; however, the generic smoothed average formula I use for the ATR does not seem to work for the Directional Indicators. If anyone can help me with this, I would appreciate some assistance.

    batrax

  • #2
    Batrax, did you ever get this figured out? I am also having trouble reproducing qchart adx +di and -di values. I can calculate rsi and macd without problems, but not adx. So, I just wondered if you had made any progress with this?

    Thanks.
    E.

    Comment


    • #3
      I have not yet. For ATR I use a smoothing average, TR_avg(idx) = smoothing_constant*(TR(idx)-TR_avg(idx-1)) + TR_avg(idx-1). This equation works for all periods, but the follow on equations for directional indicators do not seem to work for me, though I believe I can get directional movement correct. I do not think the above equation works for directional movement averaging; there must be a different equation. I also have trouble figuring out how QCharts does some of its initial averaging at the beginning of a price range.

      If I do not get any more info soon, I will email ESignal back and see if I can get more help, or get help here from some tech support. So far my request for assistance has not been answered with any in depth explanation.

      Comment


      • #4
        Hi Guys.
        This works (both directional and adx).

        Good luck.
        nall.

        Comment


        • #5
          did not work for me

          Thanks nall for your reply!! I tried your formula and still am not getting the same values as QCharts. If this works for you, can you tell me what length and adxLength (I tried length=13 and adxLength=5) you are using and what specific stock you tested it on? I tried on several different stocks and never got close to the same values as QCharts.

          Comment


          • #6
            Re: did not work for me

            Originally posted by ethanmls
            Thanks nall for your reply!! I tried your formula and still am not getting the same values as QCharts. If this works for you, can you tell me what length and adxLength (I tried length=13 and adxLength=5) you are using and what specific stock you tested it on? I tried on several different stocks and never got close to the same values as QCharts.
            I tested these on GOOG daily and got exact matches for all bars I spot checked. Note that length is the +DI/-DI length paramter. adxLength is the ADX smoothing paramter.

            You'll also probably need to multiply the +/-DI values by 100.

            Let me know if you still have issues.

            nall.

            Comment


            • #7
              It worked!

              Ok, I had the lengths backward - sorry I should have tried switching. But, now it works perfectly!! I verified with goog, aapl, and cme!!

              Many Thanks!!

              Comment

              Working...
              X