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 fx.practic, 10-15-2013, 12:53 AM
            5 responses
            5,404 views
            0 likes
            Last Post Bidder
            by Bidder
             
            Started by Shai Samuel, 07-02-2022, 02:46 PM
            4 responses
            95 views
            0 likes
            Last Post Bidder
            by Bidder
             
            Started by DJ888, Yesterday, 10:57 PM
            0 responses
            8 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by MacDad, 02-25-2024, 11:48 PM
            7 responses
            159 views
            0 likes
            Last Post loganjarosz123  
            Started by Belfortbucks, Yesterday, 09:29 PM
            0 responses
            8 views
            0 likes
            Last Post Belfortbucks  
            Working...
            X