Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stop Entry Cancelling When Hit

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

    Stop Entry Cancelling When Hit

    I'm trying to write a breakout strategy that uses stop entries. I use the EnterLongStop function, specifically:

    Code:
    entryOrder1 = EnterLongStop(contracts/2, High[0] + TickSize, "Long 1a");
    entryOrder2 = EnterLongStop(contracts/4, High[0] + TickSize, "Long 1b");
    entryOrder3 = EnterLongStop(contracts/4, High[0] + TickSize, "Long 1c");
    I'm trying to test and debug in replay. When the market gets to the entry stop, the order gets cancelled. The output window says:

    12/12/2014 1:57:38 AM Cancelled expired order: BarsInProgress=0: Order='565e59ed29dc4992821cb38c11026bd5/Replay101' Name='Long 1a' State=Working Instrument='ES 03-15' Action=Buy Limit price=0 Stop price=2022.25 Quantity=2 Strategy='First' Type=Stop Tif=Gtc Oco='' Filled=0 Fill price=0 Token='565e59ed29dc4992821cb38c11026bd5' Gtd='12/1/2099 12:00:00 AM'
    12/12/2014 1:57:38 AM Cancelled expired order: BarsInProgress=0: Order='4ec0744437b54399a657e172e3003246/Replay101' Name='Long 1b' State=Working Instrument='ES 03-15' Action=Buy Limit price=0 Stop price=2022.25 Quantity=1 Strategy='First' Type=Stop Tif=Gtc Oco='' Filled=0 Fill price=0 Token='4ec0744437b54399a657e172e3003246' Gtd='12/1/2099 12:00:00 AM'
    12/12/2014 1:57:38 AM Cancelled expired order: BarsInProgress=0: Order='fff55c8382ae4382b2e21b56e5f0c469/Replay101' Name='Long 1c' State=Working Instrument='ES 03-15' Action=Buy Limit price=0 Stop price=2022.25 Quantity=1 Strategy='First' Type=Stop Tif=Gtc Oco='' Filled=0 Fill price=0 Token='fff55c8382ae4382b2e21b56e5f0c469' Gtd='12/1/2099 12:00:00 AM'

    Any help is appreciated.

    #2
    Hello GLockwood,

    The managed orders are designed to be cancelled on at the end of a bar if the order is not resubmitted.

    What this means is that when the OnBarUpdate() is called, and the orders are not re-submitted, meaning the logic doesn't place them again, they will cancel out

    You can either use the overload to be Live Until Cancelled and set it true, or build logic to keep the orders live for each Bar Update.
    Overload to keep Live Until Cancelled -
    http://www.ninjatrader.com/support/h...erlongstop.htm

    Reference sample on keeping orders alive -
    http://www.ninjatrader.com/support/f...ad.php?t=19169
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Thx for explainning that. I solved the same thing. But now I dont understand some next definitions.
      I have breakout strategy with Stop orders like this:
      ..
      EnterLongStop(0, true, DefaultQuantity, zzHighValue, "LiSiZZHigh");
      ..
      EnterShortStop(0, true, DefaultQuantity, zzLowValue, "LiSiZZLow");
      ..


      1. if strategy open buy order, it works (order waits), but if price is fallen ,strategy cannot open sell orders. what define permition for orders on both sides?
      2. if strategy open buy order, and than price designate new buy signal on lower price (first order is not filled), first order is cancelled and only last order is active. where I can define, if I want stay working all earlier orders untill strategy say cancel it?
      3. is there possible see waiting and working orders on the chart same as during manual trading from chart trader for better visualisation runnig strategy? or I have to define plot marks in my strategy?
      thanks for all tips.

      Comment


        #4
        Libri, we're glad to hear that. The working buy order would need to be canceled first in the managed mode in order to submit in a non market order to sell, this is part of our internal order handling rules (https://www.ninjatrader.com/support/...d_approach.htm)

        They would not be present in unmanaged mode - https://www.ninjatrader.com/support/...d_approach.htm

        If you submit the order again with the same signal name, NT would just update it to the new price value (like happening in your case). Depending on your EntryHandling you could create multiple entries / orders though (for example provide a unique name per signal you want) -



        ChartTrader could not be enabled unfortunately for a chart where you also run your script from, but you could for example open an identical chart and monitor from there. Generally though we would discourage from trying to manually manipulate orders managed by a NinjaScript strategy.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        85 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        47 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