Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trade: exit time before entry time

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

    Trade: exit time before entry time

    Hi,

    I'm backtesting my strategy. When I check Trades tab I can see, that some trades were exited before they were entered. How is that? See second trade in the attached screenshot(Entry time and Exit time).

    Best,
    Ondrej
    Attached Files

    #2
    Hi Ondrej,

    Thanks for the post and welcome to the NinjaTrader forums. You can sometimes see this affect when backtesting against multiple time frames. The stop loss looks at all bar series, so there's a chance this is filled on the other series bars. If this doesn't sound like what's causing it, can you let us know how your strategy is setup - a code sample and interval settings.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Hi,

      thanks for reply and sorry for my late response. Yes, it seems that this is a cause of a problem (multiple time frames + stop loss evaluation against each time frame). Is there some 'simple' workaround?

      Thanks.

      Best,
      Ondrej

      Comment


        #4
        Hi Ondrej,

        Instead of SetStopLoss(), you could use ExitLongStop(). This allows submission of the order to any series (barsInProgress index parameter) when using the advanced method signature.


        Although to get the same timing on submission (sent on entry execution) would require working with advanced handlers like OnExecution()
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_RyanM View Post
          Although to get the same timing on submission (sent on entry execution) would require working with advanced handlers like OnExecution()
          http://www.ninjatrader.com/support/h...n_program2.htm
          Is there a sample script for this sort of OnExecution handling for a profit target and controlling the series? Would the SampleOnOrderUpdate be the closest example?

          Comment


            #6
            Hello zachj,

            That is correct, the SampleOnOrderUpdate strategy demonstrates this, however it does not demonstrate it for multi series strategies.

            For the reference sample of SampleOnOrderUpdate please visit the following link: http://www.ninjatrader.com/support/f...ead.php?t=7499

            For information on multiple time frames and instruments in your code please visit the following link: http://www.ninjatrader.com/support/h...nstruments.htm

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            86 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            48 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            29 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            32 views
            0 likes
            Last Post TheRealMorford  
            Started by Mindset, 02-28-2026, 06:16 AM
            0 responses
            67 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Working...
            X