Announcement

Collapse
No announcement yet.

Back Test Help Please

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

  • Back Test Help Please

    Hi,

    I just getting familiar with backtesting. Could someone show me how I could go about recoding the attached efs for backtesting?

    Thanks

    Carlton
    Attached Files

  • #2
    All,

    I think I have managed to code my first backtest. Can someone please check it -when you get a chance.

    Cheers

    Carlton
    Attached Files

    Comment


    • #3
      Nah,

      My backtest isn't working. Oh well, at least I tried.

      Carlton

      Comment


      • #4
        I got it to work.

        I feel very proud of myself.

        Question. Is it possible to backtest just a particular day?

        Thx.

        Carlton

        Comment


        • #5
          Carlton
          See this thread for a solution to a similar question
          Alex

          Comment


          • #6
            Alex,

            I just want to see results between 9:30 and 16:00, however even when I follow the example it still overlaps into the following day.

            Also, is it correct to assume that interval is the number of minutes on the chart?

            Thx.

            Carlton

            Comment


            • #7
              Carlton
              What is it that overlaps into the following day? The data, the trade, other?
              Interval is the time frame used in the chart (from Monthly to Tick)
              Alex

              Comment


              • #8
                Alex,

                If you check out number 13 you'll see that there was a buy at 01/08/04 and a sell at 01/09/04. What I really would like is for the backtest to close out the trade 4pm 01/08/04. See attachment.

                Thx

                Carlton

                Comment


                • #9
                  Alexis,

                  Sorry, I was able to send attachment - too big. Anyway, I have cut and paste the an example of what I mean. I hope it makes sense.


                  13 Buy Long 01/08/2004 11.50 $3.38 100 $25.09 $107.87 $37.99
                  $0.00 0.03% 0.00%
                  Sell Short 01/09/2004 12.40 $3.63 100


                  Thx

                  Carlton

                  Comment


                  • #10
                    Carlton
                    You need to set up the strategy to do that.
                    If for example you always want to close the trades at 16:00 and your Time Template is set to 09:30-16:00 then you will need to add commands similar to the following
                    if(Strategy.isLong()==true && (getHour()*100)+getMinute()==1559){
                    Strategy.doSell(etc,etc)}
                    Then the same to cover shorts.
                    Do not use 1600 as the time to close the trades because that time stamp would not exist.
                    Also depending on the interval make sure that the closing time of the trade actually corresponds to an existing time stamp. For example if you use a 2 min chart then setting the closing time to 1559 will not work because there will be no bar on the chart that has that time stamp.
                    Hope this helps
                    Alex

                    Comment


                    • #11
                      Alexis,

                      I see what you mean.

                      Cheers mate..

                      Carlton

                      Comment


                      • #12
                        Alexis,

                        I cut and paste the piece of code you gave me but it doesn't work.

                        Carlton

                        Comment


                        • #13
                          OK,

                          I managed to get it work, but its still overlapping.

                          Carlton

                          Comment


                          • #14
                            Alexis,

                            I wonder if you could take a quick look at the efs when you get a chance. I added the additional code you mentioned but the times are still overlapping i.e. it won't close the trade at 4pm.

                            Cheers

                            Carlton
                            Attached Files

                            Comment


                            • #15
                              Carlton
                              I gave a brief look at the efs you posted and it seems to me that you simply copied the example I provided without filling in the appropriate commands (ie the do.Sell and do.Cover functions are incomplete). Also if you are using a Time Template that has 16:00 as the End Time you will not get a Sell or Cover because a bar with that time stamp does not exist in the chart.
                              Anyhow, run the attached backtest-example.efs on a 5 minute chart with a 24 hour Time Template. You should see that it will close the trades at the end of the day and that it will not trade outside of the established hours (see image below). Note that if you use (for example) a 3 min chart it will not close the trades for the reasons I explained in my prior message.
                              Alex

                              Attached Files

                              Comment

                              Working...
                              X