Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Backtest problem: Entry and stop loss within one bar

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

    Backtest problem: Entry and stop loss within one bar

    Hi!
    I am developing a strategy for a client which is trying to catch big moves.

    The backtest results are complete wrong because whenever the entry price and the stop loss price is within the same (one minute) bar the backtest executes the stop loss.

    I know that this behavior is intended but in order to get my clients backtest to work I would need a workaround fot this!

    Any idea how to fix this?

    Thanks in advance!
    DH

    #2
    Hello DH,

    To work around this you have to move away from the Set statements and code a multiseries strategy. The secondary series should be smaller than the primary, and you use the advanced overload for methods ExitLongStop() and ExitShortStop() that allow submission to a specific series.

    You can submit orders to different Bars objects. This allows you the flexibility of submitting orders to different timeframes. Like in live trading, taking entry conditions from a 5min chart means executing your order as soon as possible instead of waiting until the next 5min bar starts building. You can achieve this by
    Last edited by NinjaTrader_RyanM1; 04-28-2011, 10:33 AM.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Ryan,
      Thanks for the quick reply!

      The problem is, I am working on 1 minute bars which is the smallest time frame I have....

      Any undocumented features?

      Comment


        #4
        There are no undocumented features here and generally we are unable to provide support for items outside the documentation.

        Alternatives:
        Adding a series smaller than minute - Tick.
        Start with a wide stop loss that is submitted on the entry bar, and then narrow this after one bar.
        Use market replay with fast playback speed (can go up to 500x) to simulate strategy behavior in real time conditions.
        Last edited by NinjaTrader_RyanM1; 04-28-2011, 11:09 AM.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Well, that's not helping me.
          Most of the backtests deliver wrong results with this feature.

          Generally, that's a known problem in back testing.

          Other systems have optional functions to prevent a stop loss event in case the stop loss is within the entry bar and the entry bar points in the direction of the trade.

          Maybe you could implement this feature in the next release. And, it would be very helpfull to have a report pointing out this special situations.

          I am doing back testing since quite a while, with different systems for different clients and this is an issue which pops up pretty often, and, it can change back test results dramatically.

          best regards
          DH

          Comment


            #6
            Thanks for your feedback, DH. We have this is a suggestion with ID # 688.
            Ryan M.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            648 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            369 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            108 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            572 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            573 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X