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 cmoran13, Yesterday, 01:02 PM
        0 responses
        27 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        18 views
        0 likes
        Last Post PaulMohn  
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        160 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        95 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        148 views
        2 likes
        Last Post CaptainJack  
        Working...
        X