Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Back-testing difference (single day vs multiple days)

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

    Back-testing difference (single day vs multiple days)

    I'm back-testing a strategy and have run into a frustrating situation. When I run my strategy against a whole month (10/1 - 10/31) the strategy doesn't manage my trades as expected. When I run my strategy against a single day (10/22) the strategy does manage my trades as expected.

    I've downloaded all tick, minute, and day data for the instrument and time period. Why is this occurring?

    I've included a screenshot of the same trade when back-tested within a multiple day time frame and when back-tested just using a single day. You can clearly see the trailing stop that is used on the trade in the single day back-test. So, I know the code is working properly. Did I setup the back-test incorrectly?

    Thanks in advance.
    Mike
    Attached Files

    #2
    Hello Mikefra,

    I would focus on which test is not running as expected for you. The left image shows a stop loss executed at the same price as your entry price. How was this order submitted? What were the exact values used if you plugged in a variable, etc. Use TraceOrders and Print() statements to track this type of info.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Ryan, I'm running exactly the same code on both tests. On the left image I ran strategy analyzer for 10/1 - 10/31. On the right image I ran strategy analyzer for only 10/22. Below is the code I use to manage my stop after the target has been reached.

      double stopPrice = SmallTrendFast;
      SetStopLoss(CalculationMode.Price,stopPrice);
      DrawDot("Stop" + CurrentBar, true, 0,stopPrice, Color.Orange);

      I don't understand how it could be a problem with how I submitted my order considering both cases use the identical code. Any other thoughts?

      Comment


        #4
        It most likely has to do with differences in the value stopPrice.

        Track its value per bar to identify what's happening with it.

        Print (CurrentBar + ": " + stopPrice);
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Ok, thanks Ryan.

          Also, could it possibly be stop orders from earlier trades causing the new trade to stop out at the exact moment of entry? Do I have to manually cancel stop orders if I close an order with ExitLong()/ExitShort()?

          Comment


            #6
            Stop orders from open positions prior to this trade could have an impact here. If the earlier trade was closed then there will be no working exit orders to manage or cancel. Stop loss orders are automatically cancelled if the trade is closed.
            Ryan M.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by alifarahani, Today, 09:40 AM
            6 responses
            39 views
            0 likes
            Last Post alifarahani  
            Started by Waxavi, Today, 02:10 AM
            1 response
            18 views
            0 likes
            Last Post NinjaTrader_LuisH  
            Started by Kaledus, Today, 01:29 PM
            5 responses
            15 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by Waxavi, Today, 02:00 AM
            1 response
            12 views
            0 likes
            Last Post NinjaTrader_LuisH  
            Started by gentlebenthebear, Today, 01:30 AM
            3 responses
            17 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Working...
            X