Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CancelOrder in OnMarketData

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

    CancelOrder in OnMarketData

    Hello,

    my cancelOrder doesn´t work in onMarketData. Is there any restriction? When the condition in onmarketdata is true then the new limitorder "LLa" is correctly working but the limitorder "iLa" that should be cancelled is persisting.
    if(...true)
    CancelOrder(entryOrderiLa);
    entryOrderiLa = null;
    entryOrderiLLa=EnterLongLimit(0,true,1,linevalue-2*TickSize, "iLLa");

    When the new limit "iLLa" is there then this shows that conditions are OK. Why isn´t the "iLa" cancelled?

    Thank you!
    Tony

    #2
    Hello Tony,

    Thank you for your post.

    You should be able to use CancelOrder() in OnMarketData().

    If the following all within OnMarketData() and occurs when the condition is true?
    Originally posted by tonynt View Post
    if(...true)
    CancelOrder(entryOrderiLa);
    entryOrderiLa = null;
    entryOrderiLLa=EnterLongLimit(0,true,1,linevalue-2*TickSize, "iLLa");
    If so, you need to wait for the order to actually cancel in the OnOrderUpdate() method before assigning it null and then writing a new order to it.

    Comment


      #3
      Hello Patrick,

      thank you for your reply.

      I tested round with onorderupdate and this doesn´t help.

      But when I do comment //entryOrderiLLa=EnterLongLimit(0,true,1,linevalue-4*TickSize, "iLLa");

      then the iLa is cancelled correctly with conditons.

      What is the interdependence of these please???

      Why is entryorderiLa NOT cancelled when I do also a new entryorderILLa ?



      Thank you
      Tony
      Last edited by tonynt; 10-07-2015, 01:48 PM. Reason: experience on testing in the meantime

      Comment


        #4
        Hello Tony,

        Thank you for your response.
        with conditions true in onmarketdata one limitentryOrder should be cancelled and immediately the new one should working. (or the new one working and then the first limit be cancelled - if this is the only and correct way to do. Do I understand right?)
        No, the cancel command would be sent but you would need to wait for confirmation of this first and then set it to null and then submit the new order.

        We need two order updates here. First then one that calls your CancelOrder(), then we need to wait for the OnOrderUpdate() that confirms the order is order.OrderState == OrderState.Cancelled before submitting a new order or setting it to null.

        Comment


          #5
          Patrick,

          same moment I did a post to your reply. Please see also above your recent post.

          I do always more than one entryOrder with different Iordername and different signalname.

          Why does not work cancelling (when there are 2 different iorders and signalnames)

          CancelOrder(entryOrderiLa);
          entryOrderiLa = null;
          entryOrderiLLa=EnterLongLimit(0,true,1,sp.Value[0]-2*TickSize, "iLLa");

          but cancelling works with

          CancelOrder(entryOrderiLa);
          entryOrderiLa = null;
          //entryOrderiLLa=EnterLongLimit(0,true,1,sp.Value[0]-2*TickSize, "iLLa");

          ???

          Why does one need to wait for order state cancelled when it is another Iorder? (If it would be the same Iorder than all would be clear).


          AND MOREOVER: I have in onorderupdate (like in the NT-sample)

          // Checks for all updates to entryOrder.
          if (entryOrderiLa != null && entryOrderiLa == order)
          {
          // Check if entryOrder is cancelled.
          if (order.OrderState == OrderState.Cancelled)
          {
          // Reset entryOrder back to null
          entryOrderiLa = null;

          But it is not cancelled as soon as I bring in the other entryorder as shown above.

          Total confusion, sorry.

          Thank you
          Tony
          Last edited by tonynt; 10-07-2015, 01:59 PM. Reason: clearifying

          Comment


            #6
            Hello Tony,

            Thank you for pointing that out, I missed the different IOrder name.

            Can you provide the full script or a test script that produces the same scenario? I would not expect what you are seeing.

            Comment


              #7
              Hello Patrick,

              thank you for your reply. This answer is the first that helps me as with this I know that it should work and I have to find the error from another approach.

              Best
              Tony

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by lightsun47, Today, 03:51 PM
              0 responses
              5 views
              0 likes
              Last Post lightsun47  
              Started by 00nevest, Today, 02:27 PM
              1 response
              9 views
              0 likes
              Last Post 00nevest  
              Started by futtrader, 04-21-2024, 01:50 AM
              4 responses
              45 views
              0 likes
              Last Post futtrader  
              Started by Option Whisperer, Today, 09:55 AM
              1 response
              14 views
              0 likes
              Last Post bltdavid  
              Started by port119, Today, 02:43 PM
              0 responses
              9 views
              0 likes
              Last Post port119
              by port119
               
              Working...
              X