Announcement

Collapse
No announcement yet.

Directional Movement Indicator Error?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Directional Movement Indicator Error?

    As I am heavily reliant on the DMI/ADX indicator for many of my trading startegy decisions and as I am researching using this formula in a non conventional way but utilizing the methodology, I have written my own efs study from scratch using what I beleive is the correct methodology as given by Welles. However, when checking my results against the built in study there are a number of anomolies every so often seen in all 3 indicators (PDI, MDI & ADX).

    I reported a bug previously in the built in ATR study which was confimred back to me that it does exist (still no fix yet?), I am wondering if the same issue is involved here, as this study uses the True Range formula which was seemingly incorrectly applied in the built in ATR study.

    See my efs study which is attached to make comparisons and you will see the differences every so often (noticebly so in shorter time periods), and especially when outside bars are encountered or bars with a current no range (i.e. in futures intraday instruments). Also I do not believe that the built in formula works correctly right at the beginning of a data series also. My study can be checked in this regard also.

    I would appreciate feedback as soon as possible because if I am correct I need to then use my formula in all my trading strategies rather than the built in one which I have been using for some time. Also it will allow me to use my formula for other studies I am considering writing in the near future.

    Robert
    Attached Files

  • #2
    I'll take a stab at the problem, but first tell me this, if I want to print the current adx, pdi and ndi, what values do I send to debugPrintln?

    Comment


    • #3
      I've added a debugging info section as per attached revised file. Good luck!

      Robert
      Attached Files

      Comment


      • #4
        My debugging show pdi and ndi are the same but adx is slightly different.

        The chart looks very similar.
        Attached Files

        Comment


        • #5
          1 min es chart attached
          Attached Files

          Comment


          • #6
            Also, the Cursor window reports the same values for adx pdi and ndi to 2 decimal places for all bars I checked.

            Comment


            • #7
              There are some subtle differences which for me are very important in my trading decisions and as I want to use the code I have presented for non conventional use and therefore I would like to get a confirmation that the methodology is sound or if there is an error in the logic that I can correct it before proceeding with further work.

              However if it is true that my code is correct and the built in study has bugs, then I will rip out the usage of the built in study in all my efs studies and substitute mine unless eSignal comes up with a fix.

              I have noticed significant enough discrepancies especially in pretrading futures data (i.e. YM #F) where no range bars occur frequently followed by outside day bars which throw both studies apart. As I measure new trend strength using the ADX formula using various parameters any errors can be lead to incorrect strategy decisions. In fact unless I hear anything else I will be rigorously testing my code in real trading next week to see if it helps or hinders me. Maybe even if my code is technically right it might be not to my advantage to use it!

              Robert

              Comment


              • #8
                Can you post a picture of where the discrepancies are?

                Do you know why pdi and ndi are very close - out to about the 100th decimal point?

                Do you know why the internal adx and nADX_G do not agree in my debug line?

                Why is your nADX_G not in agreement with the value of nADX_G returned in the cursor window?

                I think some of those answers will help you understand if you agree with the internal adx values or not.

                Note: when the internal adx 8x8 and your 8x8 are superimposed, the correlation seems identical, with the exception of the scaling.
                Attached Files

                Comment


                • #9
                  Concerning the debugging ADX output, I have added a new variable to take care of this problem as per attached. why this descrepency happens is beyond me as the display is correct. Please see further postings of the kind of problems I am experiencing with my data.

                  Robert
                  Attached Files

                  Comment


                  • #10
                    Here is an output of the values using a playback file where there are large discrepencies between using the built in ADX formula (upper study) vs. the one I have written. These large discrepncies do not clear up until about 200-300 bars in as the built in formula start is completely illogical and therefore starts with values that continue to be wrong for quite a period of time together with what I believe is a computational problem on the true range.

                    Robert
                    Attached Files

                    Comment


                    • #11
                      Here is a study based on current data where the values are more in line, but there are subtle differences which would affect my trading decisions. For example in this screenshot I would have already recognized a down trend 1 bar earlier using my formula and therefore would have taken action that would have yielded a larger potential profit.

                      Robert
                      Attached Files

                      Comment


                      • #12
                        Here is a screeshot where I ahve superimposed my study where the lines a resolid with the built in study where the lines are dotted and you can see on outside day bars the studies diverge quite significantly. In the one case the outside bar follows a no range bar which causes the difference IMO.

                        I hope that eSignal's development team can throw some light on this issue. Thanks for your input .

                        Robert
                        Attached Files

                        Comment


                        • #13
                          Is it possible the logic you use has an error when outside days are accounted for?

                          Could be the internal one has an issue - I suspect you know what you are doing cuz the pdi and ndi are always right on.

                          Seems strange your pdi and ndi would be done correctly and adx is wrong.

                          We'll see soon enuf, I am sure.

                          Comment


                          • #14
                            Robert,

                            Could not analyze fully your efs (got confused in parameters names) but I suggest that you review the following two parts:

                            1. Initialization of ADX. Welles Sum is tricky there, because it carries over the initial values forever. Sometimes you see, sometime you dont. And this can explain why PDI and NDI are correct (I am using ADx fairly extensive myslef).
                            For and example, check the EnhancedRSI.efs in the Library, they use Welles sum there.

                            2. You have a fnRnd function, that I do not know where and how in affects your ADx values. Check it out!

                            Good Luck!
                            Mihai Buta

                            Comment


                            • #15
                              I am a bit dissappointed that no one form the eSignal development team has addressed this issue. As this is a basic indicator within eSignal it would be good to know that it is working perfectly and if not that it will be fixed in the up coming release.

                              I still believe that my formula follows Wilders methodology precisley and have now had the opportunity to test it for some time since my last posting and have found it to be stable, however the issue is one of methodology and I feel that eSignal's formula does not handle True Range well as I discovered in the canned ATR function which was confirmed as buggy.

                              Robert

                              Comment

                              Working...
                              X