Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Pending Orders behaviour

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

    Pending Orders behaviour

    Hi

    Could you please help with pending orders in NT8? My strategy based on placing a bunch of pending orders (Stop-limit) almost each bar, both long and short direction.
    But the strategy is sending only one order from one direction

    An example (NQ!, 15m TF, OnBarUpdate) :

    Code:
    EnterLongStopMarket(16000);
    EnterLongStopMarket(17000);
    
    EnterShortStopMarket(14000);
    EnterShortStopMarket(13000);
    
    
    SetStopLoss(CalculationMode.Ticks, 100);
    SetProfitTarget(CalculationMode.Ticks, 200);


    What I'm expecting (assuming that current NQ price is 15000):
    1) 1st StopMarket Long Order at price 16000 (Accepted status)
    2) 2nd StopMarket Long Order at price 17000 (Accepted status)
    3) 3rd StopMarket Short Order at price 14000 (Accepted status)
    4) 4th StopMarket Short Order at price 13000 (Accepted status)

    What I'm receiving from that list:
    2) 2nd StopMarket Long Order at price 17000 (Accepted status)


    + I don't see any error messages from Logs. As far as I could see only one log for successful StopMarket Long Order for price 17000
    9/7/2023 7:57:40 PM Order Order='eb66fbe0dcfc49b5b2087f40040b0100/Sim101' Name='Buy' New state='Accepted' Instrument='NQ SEP23' Action='Buy' Limit price=0 Stop price=17000 Quantity=1 Type='Stop Market' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''


    The strategy settings for max possible orders:

    Click image for larger version

Name:	image.png
Views:	229
Size:	20.2 KB
ID:	1267948


    Am I wrong with some strategy initialization or attaching process somehow?
    I checked some other topics and feels like it's allowed to have multiple StopLimit in both directional


    Thanks,
    Igor

    #2
    Hello Igor,

    Thanks for your post.

    Bracketing working opposing entry orders with OCO is too advanced for the managed approach.

    The unmanaged approach would need to be used if you want to place Buy Stop Market and Sell Stop Market orders simultaneously.

    Below is a link to an example that you could view.
    https://ninjatrader.com/support/foru...926#post486926

    Note that you cannot go Long and Short at the same time. You would only be able to enter a Long position or a Short position, not both.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      Wow

      I just checked this with UnManaged strategy - multiple pending orders are placed, using SubmitOrderUnmanaged I can set as many orders as I want. Thanks

      But it seems this approach is heavy brutal since every other default order method (like SetStopLoss) will not work anymore, and I need to handle absolutely everything manually, starting from how max orders count, their stop losses and target profits?

      Also, as far as I understand, I critically need to track(store) all Orders (I assume, in some sort of List or Array) if I want to cancel some of them or at least check already set orders to avoid duplicates, am I correct?

      Your example UnmanagedOCOBracketExample_NT8.zip​ is very nice


      Best Regards,
      Igor

      Comment


        #4
        Hello Igor,

        Thanks for your notes.

        Yes, you would need to handle the order management within the script.

        SetStopLoss() and SetProfitTarget cannot be used when coding a strategy using the Unmanaged Approach. You would have to use the SubmitOrderUnmanaged() method to submit all entry and exit orders from the strategy. The order objects should be tracked to properly manage them as seen in the example script.

        The ChangeOrder() method could be used if you need to change the price of an order. The CancelOrder() method would be used if you want to cancel an order.

        See this Unmanaged Approach help guide page for more information: https://ninjatrader.com/support/help...d_approach.htm
        <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Today, 05:17 AM
        0 responses
        20 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        119 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        63 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        41 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        45 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X