Announcement

Collapse
No announcement yet.

Back Test Help Please

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

  • #16
    Linus
    I do not know what you mean by code specific.
    Anyhow, if you want to close a trade at the end of every day you need to make sure that in the chart there is a bar with the time stamp you use in the efs.
    If you use a 2 min chart for example you cannot set a trade closing time for 1553 because there will be no bar on the chart that has that time stamp hence the trade will not be closed at the end of the day.
    As to 1600 I did not say it cannot be used. However IF the Time Template ends at 1600 it cannot be used because in that case the last bar will not be time stamped 1600.
    Hope this helps
    Alex

    Comment


    • #17
      Alexis,

      Is Linus correct when he states that, in this code only 1, 5, 7, 11, or 35 minute intervals are possible? I don't see how 7, 11 minute intervals can be used because there won't be a bar with that time stamp.

      Carlton

      Comment


      • #18
        Carlton
        Yes he is correct. All the intervals will have a bar timestamped 15:55
        Alex

        Comment


        • #19
          Alexis,

          Please excuse me if I appear a little ignorant, but how can 11 be correct? I don't see how a bar can be timestamped at an interval of 11 if we're using 5 min intervals. Maybe I just don't understand the concept of intervals.

          Thx.

          Carlton

          Comment


          • #20
            Carlton
            Linus was referring to my efs that has a close trade time of 1555.
            So the intervals he mentioned will have a bar time stamped 1555
            Alex

            Comment


            • #21
              Oh my word

              I still don't get it.

              Alexis, would it be possible to give me some kind of illustration. How, will an 11 min interval have a bar timestamped 1555?

              Thank you.

              Carlton

              Comment


              • #22
                Carlton
                Enclosed is an 11 min chart with the trade closing on the 15:55 bar.
                Having said that rather than focusing on a single interval you can also define a closing time range so as to allow for flexibility in the use of intervals. The attached efs uses a range of 15 minutes (between 15:45 and 16:00) to close the trades.
                Alex

                Attached Files

                Comment


                • #23
                  Alexis,

                  Thats great.

                  Linus, forgive me, but how did you arrive at 385 mins? I know I'm most probably revealing my ignorance but I have to ask.

                  Thx

                  Carlton

                  Comment


                  • #24
                    Now this is getting a little weird!

                    Line 213 and 229 are identical to the example you provided earlier, however I still see in trades taking place outside of 15:55pm, but when I back test with your efs it works fine.

                    Please tell me where am I going wrong. I thought I was doing pretty well with this Backtesting.

                    Thx

                    Carlton
                    Attached Files

                    Comment


                    • #25
                      Alexis,

                      I did it

                      I managed to get it to work. Its a bit messy but it appears to be working. I simply lifted the code from your previous efs and placed it on line 213 and 232.

                      I'm sure I haven't finished asking questions, but thanks anyway.

                      Cheers

                      Carlton
                      Attached Files

                      Comment


                      • #26
                        Carlton
                        First of all I would separate the conditions (and relative commands) that close the trades and place them after the conditions that initiate longs and shorts . I would also change the text of the closing trades so as to make it easier to identify them in the Strategy Analizer Report.
                        After having done the above changes it should execute the closing trades at every 15:55, however it will immediately re-enter new trades as there are no other time restraints.
                        Alex

                        Edit after post: This is in reply to an earlier post and does not refer to bktestmacd-impulse(2).efs

                        Comment


                        • #27
                          Alexis,

                          I think you may have edited the wrong efs. The efs that I appeared to been successful with (bktestmacd-impulse(2).efs) had the following line of code on line 213.

                          if (Strategy.isLong() == false && (getHour()*100)+getMinute() >= 930 && (getHour()*100)+getMinute() < 1555 &&

                          This appears to prevent it from re-entering (actually I got that line of code from you)

                          Anyway, I do have another question. When I deselect "Allow Shorts" in the back testing preferences I only get, say two enteries showing me where I would have gone long. However, when I "Allow shorts" it shows me all the entries where I would have gone long. Do you have any idea why that is happening?

                          Cheers

                          Carlton

                          Comment


                          • #28
                            Alexis,

                            I will do a search to see if anybody has already asked the question why deselecting "Allow Shorts" only shows two long entries.

                            Cheers

                            Carlton

                            Comment


                            • #29
                              Its ok, I understand..

                              Cheers

                              Carlton

                              Comment


                              • #30
                                Carlton
                                The attached revision of bktestmacd-impulse(2).efs should do what you want.
                                Please understand that sometimes you cannot simply lift the code from one efs and paste into another as the logic may be slightly different.
                                Anyhow it should now take trades only between 9:30 and 15:55 and close all open trades at 15:55. This should happen also if unchecking either "Allow Longs" or "Allow Shorts"
                                Alex
                                Attached Files

                                Comment

                                Working...
                                X