Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CancelOrder()

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

    CancelOrder()

    Hi,

    With the UNMANAGED APPROACH.

    For som reason this code is not canceling the LngOrder3 and submitiing the LngOrder1BE order, I can´t find the error

    protected override void OnExecution(IExecution execution)

    if((BESrtOrder1 != null && BESrtOrder1 == execution.Order) && (LngOrder3 !=null) && (LngOrder1BE == null))
    {

    BESrtOrder1 = null;
    CancelOrder(LngOrder3);
    LngOrder1BE = SubmitOrder(0,OrderAction.Buy, OrderType.Stop,lotes,0,upper+(TickSize*offSet),"", "");
    }

    Any clue about it?

    Thanks a lot in advance.

    #2
    CJS, first of all I would ensure with Prints that the condition is really evaluating to 'true' that you've setup.

    Comment


      #3
      Well, the condition is just that BESrtOrder1 triggers, and whent it triggers the CancelOrder(LngOrder3); statement is not working.

      I have ensured with Prints that the BESrtOrder1 triggers.

      Also, LngOrder3 !=null since is has been submited
      And, LngOrder1BE == null since is has not been used yet.

      Any other idea?

      Comment


        #4
        You would need to simpilfy the code until it does what you expect and then add back other parts - I didn't really mean if you checked that the one order triggers, but that you just add a print after your order entry condition to see if all parts are working as you expect...for example a non reset IOrder from historical use, so it would not be null as you check and therefore render the complete condition false.

        also: have you checked for any log tab errors in the Control Center?

        What is the TraceOrders output saying?

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        56 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        143 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        160 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        96 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        276 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X