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 lorem, Yesterday, 09:18 AM
            5 responses
            16 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by Spiderbird, Today, 12:15 PM
            0 responses
            5 views
            0 likes
            Last Post Spiderbird  
            Started by cmtjoancolmenero, Yesterday, 03:58 PM
            12 responses
            42 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by FrazMann, Today, 11:21 AM
            0 responses
            6 views
            0 likes
            Last Post FrazMann  
            Started by geddyisodin, Yesterday, 05:20 AM
            8 responses
            52 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Working...
            X