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 NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    55 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    132 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    73 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    45 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    49 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X