Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MTF Strategy Stop Market Orders Getting Cancelled On Next Bar

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

    MTF Strategy Stop Market Orders Getting Cancelled On Next Bar

    Hello,

    I am developing a strategy where logic is performed on a higher timeframe and then orders placed using the primary series, and running into an issue with historical order processing (on the chart) and back testing (in Strategy Analyzer) which I cannot figure out.

    The strategy adds Daily bars as the second data series and makes it's decisions to trade based on the Daily data. Once an entry is determined, on the close of the first bar of the session of the primary series, the strategy places a Stop Market order.

    What is happening is the system is cancelling the Stop Market order automatically on the close of the next primary series bar. I cannot figure out why. This is happening on all different timeframes, 1m, 5m, 30m, etc

    Attached is a stripped down version of the strategy that can reproduce the behavior.

    Here is some output from the Output Console where I've captured the order updates occurring.

    Code:
    1/18/2023 12:05:00 AM: Entering Long Stop Mkt @ 4028.5, SL = 3996.75, TP = 4024.25. Current Close = 4014.25, High = 4015, Low = 4014
    1/18/2023 12:05:00 AM - Order update: orderId='NT-00000-612' account='Sim101' name='Long' orderState=Submitted instrument='MES 03-23' orderAction=Buy orderType='Stop Market' limitPrice=0 stopPrice=4028.5 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2023-01-18 00:05:00' gtd='2099-12-01' statementDate='2023-02-20'
    1/18/2023 12:05:00 AM - Order update: orderId='NT-00000-612' account='Sim101' name='Long' orderState=Accepted instrument='MES 03-23' orderAction=Buy orderType='Stop Market' limitPrice=0 stopPrice=4028.5 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2023-01-18 00:05:00' gtd='2099-12-01' statementDate='2023-02-20'
    1/18/2023 12:05:00 AM - Order update: orderId='NT-00000-612' account='Sim101' name='Long' orderState=Working instrument='MES 03-23' orderAction=Buy orderType='Stop Market' limitPrice=0 stopPrice=4028.5 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2023-01-18 00:05:00' gtd='2099-12-01' statementDate='2023-02-20'
    1/18/2023 12:10:00 AM - Order update: orderId='NT-00000-612' account='Sim101' name='Long' orderState=CancelPending instrument='MES 03-23' orderAction=Buy orderType='Stop Market' limitPrice=0 stopPrice=4028.5 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2023-01-18 00:05:00' gtd='2099-12-01' statementDate='2023-02-20'
    1/18/2023 12:10:00 AM - Order update: orderId='NT-00000-612' account='Sim101' name='Long' orderState=CancelSubmitted instrument='MES 03-23' orderAction=Buy orderType='Stop Market' limitPrice=0 stopPrice=4028.5 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2023-01-18 00:05:00' gtd='2099-12-01' statementDate='2023-02-20'
    1/18/2023 12:10:00 AM - Order update: orderId='NT-00000-612' account='Sim101' name='Long' orderState=Cancelled instrument='MES 03-23' orderAction=Buy orderType='Stop Market' limitPrice=0 stopPrice=4028.5 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2023-01-18 00:05:00' gtd='2099-12-01' statementDate='2023-02-20'
    
    ​
    And here is a screenshot of the Strategy settings
    Click image for larger version

Name:	image.png
Views:	246
Size:	28.7 KB
ID:	1236142


    Thank you for your assistance!
    -vossom




    #2
    Sorry this should have gone under the NT8 section, not NT7. Can a mod please move it?

    Comment


      #3
      Hello vossom,

      Orders that are not using the isLiveUntilCancelled parameter will have this default to false. This means when the bar closes the order will automatically be cancelled if it is not resubmitted.

      Enable TraceOrders and open the output window and re-run the script. Do you messages about orders being automatically cancelled?


      If so, use the overload with isLiveUntilCancelled with a value of true to keep orders alive, or re-submit them on each new bar.
      EnterLongStopMarket(int barsInProgressIndex, bool isLiveUntilCancelled, int quantity, double stopPrice, string signalName)




      I am also including a link to a forum post about 1-tick intra-bar granularity for order fill accuracy.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Thank you, setting isLiveUntilCancelled solved the problem. Excellent support thank you!!!

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        595 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        343 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        103 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        556 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        554 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X