Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SubmitOrderUnmanaged() don't match OCO orders

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

    SubmitOrderUnmanaged() don't match OCO orders

    Hi support!!!
    I'm sending to mkt this short trades (2)

    SubmitOrderUnmanaged(0, OrderAction.SellShort , OrderType.Market, 3, 7.638,25, 0, '', CTT_0);
    SubmitOrderUnmanaged(0, OrderAction.Buy , OrderType.StopMarket, 3, 0, 7.710,75, CTT_0-OCO, CTT_0);
    SubmitOrderUnmanaged(0, OrderAction.Buy , OrderType.MIT, 3, 0, 7.602,00, CTT_0-OCO, CTT_0);

    SubmitOrderUnmanaged(0, OrderAction.SellShort , OrderType.Market, 3, 7.630,75, 0, '', CTT_1);
    SubmitOrderUnmanaged(0, OrderAction.Buy , OrderType.StopMarket, 3, 0, 7.647,75, CTT_1-OCO, CTT_1);
    SubmitOrderUnmanaged(0, OrderAction.Buy , OrderType.MIT, 3, 0, 7.622,25, CTT_1-OCO, CTT_1)

    Why system match crossing different OCO orders, what's wrong in my code?

    Thanks!

    PD :

    1/4/2020 11:36:00 Strategy 'CTT/-1': Entered internal SubmitOrderUnmanaged() method at 1/4/2020 11:36:00: BarsInProgress=0 Action=SellShort OrderType=Market Quantity=3 LimitPrice=7638,25 StopPrice=0 SignalName='CTT_0'
    1/4/2020 11:36:00 Strategy 'CTT/-1': Entered internal SubmitOrderUnmanaged() method at 1/4/2020 11:36:00: BarsInProgress=0 Action=Buy OrderType=StopMarket Quantity=3 LimitPrice=0 StopPrice=7710,75 SignalName='CTT_0'
    1/4/2020 11:36:00 Strategy 'CTT/-1': Entered internal SubmitOrderUnmanaged() method at 1/4/2020 11:36:00: BarsInProgress=0 Action=Buy OrderType=MIT Quantity=3 LimitPrice=0 StopPrice=7602,00 SignalName='CTT_0'
    1/4/2020 11:56:00 Strategy 'CTT/-1': Entered internal SubmitOrderUnmanaged() method at 1/4/2020 11:56:00: BarsInProgress=0 Action=SellShort OrderType=Market Quantity=3 LimitPrice=7630,75 StopPrice=0 SignalName='CTT_1'
    1/4/2020 11:56:00 Strategy 'CTT/-1': Entered internal SubmitOrderUnmanaged() method at 1/4/2020 11:56:00: BarsInProgress=0 Action=Buy OrderType=StopMarket Quantity=3 LimitPrice=0 StopPrice=7647,75 SignalName='CTT_1'
    1/4/2020 11:56:00 Strategy 'CTT/-1': Entered internal SubmitOrderUnmanaged() method at 1/4/2020 11:56:00: BarsInProgress=0 Action=Buy OrderType=MIT Quantity=3 LimitPrice=0 StopPrice=7622,25 SignalName='CTT_1'
    1/4/2020 11:56:00 Strategy 'CTT/-1': Cancelled OCO paired order: BarsInProgress=0, orderId='NT-00004-271' account='Backtest' name='CTT_1' orderState=Working instrument='NQ 06-20' orderAction=Buy orderType='Stop Market' limitPrice=0 stopPrice=7647.75 quantity=3 tif=Gtc oco='CTT_1-OCO' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2020-04-01 11:56:00' gtd='2099-12-01' statementDate='2020-06-28'
    1/4/2020 12:40:00 Strategy 'CTT/-1': Cancelled OCO paired order: BarsInProgress=0, orderId='NT-00001-271' account='Backtest' name='CTT_0' orderState=Working instrument='NQ 06-20' orderAction=Buy orderType='Stop Market' limitPrice=0 stopPrice=7710.75 quantity=3 tif=Gtc oco='CTT_0-OCO' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2020-04-01 11:36:00' gtd='2099-12-01' statementDate='2020-06-28'



    Last edited by mbcito; 06-28-2020, 08:57 AM.

    #2
    Hello mbcito,

    Below is a link to an example of an unmanaged strategy that uses OCOID strings.


    What is the string value being used for the OCO?

    It appears you are using a blank string '' for the OCO and you are not using unique OCO strings.
    SubmitOrderUnmanaged(0, OrderAction.SellShort , OrderType.Market, 3, 7.638,25, 0, '', CTT_0);
    SubmitOrderUnmanaged(int selectedBarsInProgress, OrderAction orderAction, OrderType orderType, int quantity, double limitPrice, double stopPrice, string oco, string signalName)
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks Chelsea,
      My questions :

      First entry ( SellShort ) oco= "" for the stops, ocoOrder = CTT_0-OCO
      Second entry ( SellShort ) oco= "" for the stops, ocoOrder = CTT_1-OCO
      When (SubmitOrderUnmanaged(0, OrderAction.Buy , OrderType.MIT, 3, 0, 7.622,25, CTT_1-OCO, CTT_1)) takes profits, why the order closes the Order CTT_0 ???????????

      Regards Mariano

      Comment


        #4
        Hello Mariano,

        All orders using the same OCOID will tied with OCO. If one cancels, any others with that OCOID will cancel.

        Print the OCOIDs if you want to know why orders are tied with OCO.

        Below is a link to a forum post that demonstrates using prints to understand behavior.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Today, 05:17 AM
        0 responses
        43 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        124 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        65 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        42 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        46 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X