Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Is there an OrderQueue type object?

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

    Is there an OrderQueue type object?

    I've got positions that hit stops and are exited by Exit orders but right after that comes an open order which seems to be triggering a "Close Position" and the net result is I wind up with more positions than I want. Is there something like an orderQueue object one can use to check what's still in then pipeline or is the best solution to use counters and upcount downcount in OnOrderUpdate/OnExecutionUpdate?

    I only want two orders at any time but after the below output I'm winding up with 3. I see (bolded below) two close calls and one close position call executed. But there were only 2 short positions to begin with. Now after the 2 long opens I have 3 longs.

    exit for SO1K2 at 81.21
    EXECUTE; orderId='853514790' account='356213' name='SP' orderState=Filled instrument='MCL 05-23' orderAction=BuyToCover orderType='Market' limitPrice=0 stopPrice=0 quantity=1 tif=Gtc oco='' filled=1 averageFillPrice=81.24 onBehalfOf='' id=829 time='2023-04-17 09:28:46' gtd='2099-12-01' statementDate='2023-04-17'
    --- long ---
    4/17/2023 9:28:46 AM Strategy 'AzlOptimistic/293151166': Entered internal SubmitOrderManaged() method at 4/17/2023 9:28:46 AM: BarsInProgress=2 Action=Buy OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='LO1K1' FromEntrySignal=''
    4/17/2023 9:28:46 AM Strategy 'AzlOptimistic/293151166': Entered internal SubmitOrderManaged() method at 4/17/2023 9:28:46 AM: BarsInProgress=2 Action=Buy OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='LO1K2' FromEntrySignal=''
    EXECUTE; orderId='853578839' account='356213' name='SP' orderState=Filled instrument='MCL 05-23' orderAction=BuyToCover orderType='Market' limitPrice=0 stopPrice=0 quantity=1 tif=Gtc oco='' filled=1 averageFillPrice=81.24 onBehalfOf='' id=830 time='2023-04-17 09:28:46' gtd='2099-12-01' statementDate='2023-04-17'
    EXECUTE; orderId='853564136' account='356213' name='Close position' orderState=Filled instrument='MCL 05-23' orderAction=BuyToCover orderType='Market' limitPrice=0 stopPrice=0 quantity=1 tif=Gtc oco='' filled=1 averageFillPrice=81.24 onBehalfOf='' id=831 time='2023-04-17 09:28:46' gtd='2099-12-01' statementDate='2023-04-17'
    EXECUTE; orderId='853529571' account='356213' name='LO1K1' orderState=Filled instrument='MCL 05-23' orderAction=Buy orderType='Market' limitPrice=0 stopPrice=0 quantity=1 tif=Gtc oco='' filled=1 averageFillPrice=81.24 onBehalfOf='' id=832 time='2023-04-17 09:28:46' gtd='2099-12-01' statementDate='2023-04-17'
    Entry Price for LO1K1 : 81.24
    Stop for order: 1 : 81.08
    EXECUTE; orderId='853573825' account='356213' name='LO1K2' orderState=Filled instrument='MCL 05-23' orderAction=Buy orderType='Market' limitPrice=0 stopPrice=0 quantity=1 tif=Gtc oco='' filled=1 averageFillPrice=81.24 onBehalfOf='' id=833 time='2023-04-17 09:28:46' gtd='2099-12-01' statementDate='2023-04-17'​

    #2
    Hello markdshark,

    There's not a queue for orders but all order actions you submit at once will be processed. Close position is generally caused when you have a reversal. If you have an opposite entry condition becoming true at the same time you exit that will double exit the position by reversing it. You would see your exit happen in addition to close position and then an entry in the opposite direction which will cause a discrepancy for the position, the end result would be 2 in the opposite direction instead of 1.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    44 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    21 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    31 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    50 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    42 views
    0 likes
    Last Post CarlTrading  
    Working...
    X