Announcement

Collapse
No announcement yet.

variable entry/exit points

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

  • variable entry/exit points

    attached is a formula that sets the entry/exit price at the value of the donchian.

    how do i make the entry/exit price the donchian or the opening price, whichever is the worst so that the backtest will be as realistic as possible.

    thanks for the help.

    regards

    richard
    Attached Files

  • #2
    richard
    With the Formula Wizard you need to break down the conditions into two distinct Sets.
    In the attached revision of your efs I cover only the long side and as you can see I have added one condition in the first Set that requires the Open to be under the Upper Donchian. If this is true then the strategy goes long at the Upper Donchian + 0.01. If not then the efs passes on to analyze the second Set. This is essentially a copy of the first one with the exception that the strategy goes long at the Open if this is above the Upper Donchian.
    You will now need to add the same two-Set structure for the short side.
    Hope this helps
    Alex
    Attached Files

    Comment


    • #3
      thanks alex for the help

      Comment


      • #4
        Alex

        I have worked on this for most of the day but it doesn't seem to work.

        where am i going wrong??

        regs

        richard
        Attached Files

        Comment


        • #5
          alex

          just in case my formula is not that clear. i am trying to go long or go short only if the high/low is above or below the ma.

          thanks again.

          regs

          richard

          Comment


          • #6
            richard
            The problem in the strategy is caused by Set 5 where the condition is



            The Formula Wizard writes all the conditional statements (ie Sets) in a cascading series by using else if.
            What this means is that a conditional statement will be evaluated only if the preceeding one returns false. Once a conditional statement returns true the efs stops evaluating for further conditions.
            Given that 1 is always by definition equal to 1 the efs will stop evaluating for any other conditions at Set 5. Hence all the conditions that you added after Set 5 never get evaluated and as a consequence the strategy commands contained in those Sets never get executed.
            You need to ensure that the 1==1 condition is always the last one to be evaluated.

            Also in Set 6 one of the conditions is
            close() > vDonchian.getValue(DonchianStudy.UPPER)
            I believe that should be
            open() > vDonchian.getValue(DonchianStudy.UPPER)

            Lastly, in Sets 6, 7 and 8 you paint the background rather than the price bars (although you have not seen this happen because of the issue regarding Set 5)
            Hope this helps
            Alex

            Comment


            • #7
              thanks for that alex

              attached is the revised formula. could please check it is correct as the other attached file seems to take the trades when stopped out at differemt days

              regards

              richard
              Attached Files

              Comment


              • #8
                here is the other file
                Attached Files

                Comment


                • #9
                  richard
                  The attached revision should resolve the differences which were due to the order of the conditional statements
                  Alex
                  Attached Files

                  Comment


                  • #10
                    hi alex

                    i sill seemed to be getting incorrect entries. the backtest would close a short trade one bar further than it should. when i fiddled with; open() > vDonchian.getValue(DonchianStudy.UPPER) it appeared to fix the problem.

                    i then went and changed the > to >=. would this resolve the issue.

                    the backtest stock was CMN and the dates were long on 09/16/2003 and the backtest closed the trade on 09/26/2003 instead of 09/25/2003 with a reverse short.

                    appreciate your help on this.

                    regards

                    richard
                    Attached Files

                    Comment


                    • #11
                      second question alex. would not dragging the chart back past this point effect the backtest.

                      in other words do you need to do this so that the backtest calculates properly??

                      Comment


                      • #12
                        richard
                        The attached revision should fix the issue that occurs if the Open is equal to the Donchian. You will see that I changed the condition from Open >/< to >=/<= in all the sets in which it was required.
                        Alex
                        Attached Files

                        Comment


                        • #13
                          alex

                          can you check this formula for me please and let me know if it is correct.

                          thanks

                          richard
                          Attached Files

                          Comment


                          • #14
                            richard
                            The third condition in both Sets is comparing the close of the prior bar to the value of the moving average of the current bar instead of the moving average of one bar ago.
                            You need to insert a -1 offset in the conditions of the moving average.
                            Alex

                            Comment


                            • #15
                              of course. thanks alex.

                              in your experience is there a strategy that fits in well with the xtl advanced get study that gives reasonable results?

                              richard

                              Comment

                              Working...
                              X