Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Forex Sessions Issue

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

    Forex Sessions Issue

    In Strategy Analyzer, if you run a backtest for one day (beginning and ending on the same date) on a Forex instrument, the backtest will really run for 48 hours: 5 pm of the previous day through to 5 pm of the day following the begin & end date. In fact, it seems to always do 24 hours more than the intended optimization period because it will go to 5 pm of the next day after the end date. This bug only appears on time frames that continue across 12 midnight - stocks and others aren't affected like the Forex instruments are.

    - DJB

    #2
    Daniel, could you please post a screenshot of the session template you're using that causes the extra day of the backtest?

    As a workaround, couldn't you just end the backtest a day early?
    AustinNinjaTrader Customer Service

    Comment


      #3
      Here is the issue completely illustrated - look at the dates at the bottom of the chart, it spans 48 hours.

      Edit: This does not seem to occur when I try it in 2010. Odd.
      Attached Files

      Comment


        #4
        Thank you for the chart showing the issue. I'd like to test this on my end and to do so I'll also need the session template you used.
        AustinNinjaTrader Customer Service

        Comment


          #5
          It's the NT default - I haven't modified my instrument settings at all. "Forex" is the template.
          Attached Files

          Comment


            #6
            Daniel, thank you for the information. As far as I'm aware, those times are slightly arbitrary because the open/close of forex trading sessions are more-or-less determined by the broker. IB, for example, opens and closes forex trading at 19:00 EST while GAIN opens and closes at 22:00 LST.

            I ran the 24/7 template and got 2 days worth of backtest as well.
            AustinNinjaTrader Customer Service

            Comment


              #7
              I agree that it is true the exact times that a session begins/ends are arbitrary. However, I find that whenever a session template is used that crosses midnight, each 24 day will have part of two sessions and then NT will use both sessions for the one day. On three days, it'll use 4 sessions, etc, always using one more session because it takes the sessions at the end and the beginning. Then, when I do a leapfrog walk-forward where say, it does a walk forward for 3 days, and continues.... the final output is the *sum* of the walk forwards. Since each walk forward included one extra session than needed, there is overlap on the times and the final sum is off due to the accumulated overlap. This, I certainly think is a bug that needs to be corrected.

              Oh, and my note about 2010 really turned out to be due to the fact that when a day is next to the weekend, it only can do one session and not the one for the weekend. To clarify, a backtest on Wednesday only will run from say 5 pm on Tuesday to 5 pm on Thursday. But, a backtest on Friday will run from 5 pm on Thursday to 5 pm on Friday but can't go beyond that because the market is closed. Also, one on Sunday will run from 5 pm Sunday to 5 pm on Monday. So, with calculations possibly being 24 or 48 hours depending on which day, results are very inconsistent. If NT was made to always take only the first session of two possible sessions in a day, everything would be fixed and consistent... unless a day was purposefully split into multiple sessions during the day so more programming would be needed to work it all out, but wouldn't be hard.

              Comment


                #8
                DanielB, thank you for your detailed reply. I will send this in as a bug report.
                AustinNinjaTrader Customer Service

                Comment


                  #9
                  This is expected behavior. As a workaround you could create a session that starts at 12:00am and ends at 11:59pm the same day.
                  Last edited by NinjaTrader_Austin; 07-13-2010, 03:38 PM.
                  AustinNinjaTrader Customer Service

                  Comment


                    #10
                    I see....

                    I have programmed into the strategy quite a lot using rules that I outlined in the previous post to allow it to determine if it should trade or not from its present session... to still keep whatever session I choose instead of hard programming begin/end times... but to leave it in NT as an expected behavior for people to haphazardly discover when it'd take 20 minutes to fix is... odd.

                    Comment


                      #11
                      Daniel, this is currently a limitation, but thank you for the comments.
                      AustinNinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                      0 responses
                      599 views
                      0 likes
                      Last Post Geovanny Suaza  
                      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                      0 responses
                      344 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by Mindset, 02-09-2026, 11:44 AM
                      0 responses
                      103 views
                      0 likes
                      Last Post Mindset
                      by Mindset
                       
                      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                      0 responses
                      558 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by RFrosty, 01-28-2026, 06:49 PM
                      0 responses
                      557 views
                      1 like
                      Last Post RFrosty
                      by RFrosty
                       
                      Working...
                      X