Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Backtest > Time frame

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

    Backtest > Time frame

    Hi,

    Question on the "Time series" in backtesting. I'm trying to understand exactly how the Backtest Time Series works... I'm trading a currency pair and have hard-coded "only enter position of before 2:00PM" See code below...


    // Condition set 1
    if (EMA(5)[0] >= PriorDayOHLC().PriorHigh[0] + 6 * TickSize
    && ToTime(Time[0]) < ToTime(14, 0, 0))
    {
    EnterLong(DefaultQuantity, "LONG");
    }

    My question is under "Time frame > Session Ends/Begins" in the Backtest window why do my results change when I change the "Session Ends and Session Begins" parameters?

    If I've hard-coded my entry times (in Ninja Strategy), shouldn't the results remain the same regardless of "Backtest time settings"?

    On both the Ninja strategy I have "ExitOnClose = false;" as well as "Exit on close" in Backtest window set to "False"

    Thanks,
    Steve D.

    #2
    imported post

    Hi,

    The session begin/end time defined the data set that the strategy is being tested against. Changing these values change the data set (increase/decrease the number of bars) which can change the back test results.

    Rau
    RayNinjaTrader Customer Service

    Comment


      #3
      imported post

      Hi,

      Apologies, I don't think I'm explaining my issue correctly. My NinjaScript says only ENTER or EXIT trades between 12:00AM and 1:00 PM (see code below).

      && ToTime(Time[0]) > ToTime(0, 0, 0)
      && ToTime(Time[
      0]) < ToTime(13, 0, 0)

      If my strategy only ENTERS/EXITS strategies during those times, then I don't seewhy changing the Backtest "BEGIN/END Sessions" changes the results. (Assuming I have "Exit on close" set to "False".)

      I understand that if Ididn't set my ENTRY/EXIT times in my strategy that yes,changingBacktest "BEGIN/END Sessions" will clearly alter my results.

      For example, when I set Backtest "BEGIN/END Sessions" to 12:00AM-12:00AM, I get different results than when I set the Backtest "BEGIN/END Sessions" to 12:00AM-1:00PM. Since, my Ninja Strategy strictlyinstructs to only ENTER or EXIT positions from 12:00AM-1:00PM, seems like my backtest results should be consistent regardless of "BEGIN/END Sessions" settings?

      Let me know if I'm still not clear.

      Thanks,
      Steve D.

      Comment


        #4
        imported post

        Changing the historical data set can affect your results. There are many variables such as how bars are built based if they are tick based intervals for example. A chart with defined sessions times on tick based intervals can look very different than one without a 24 hour session defined.

        I suggest running a test on a small data set range (5 days for example), run each one in a separate market analyzer window, one with 24 hour range, one with a session defined, then compare the two results, trade for trade to see what the difference is.

        Ray
        RayNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by helpwanted, Today, 03:06 AM
        1 response
        7 views
        0 likes
        Last Post sarafuenonly123  
        Started by Brevo, Today, 01:45 AM
        0 responses
        7 views
        0 likes
        Last Post Brevo
        by Brevo
         
        Started by aussugardefender, Today, 01:07 AM
        0 responses
        5 views
        0 likes
        Last Post aussugardefender  
        Started by pvincent, 06-23-2022, 12:53 PM
        14 responses
        242 views
        0 likes
        Last Post Nyman
        by Nyman
         
        Started by TraderG23, 12-08-2023, 07:56 AM
        9 responses
        384 views
        1 like
        Last Post Gavini
        by Gavini
         
        Working...
        X