Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ChangeOrder

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

    ChangeOrder

    I'm using e.g. EnterLongStopLimit(1, true, 1, 3951.5, 3951.5, "LSL") to get an entry at a particular price.

    if marketposition is flat and order.Filled = 0 then I may use ChangeOrder to lower the price.

    in real-time (but not historically) I sometimes get this in my log: "Stop price can't be changed below the market"

    any ideas what I may be doing wrong?

    #2
    Hi, thanks for posting. The price you are using is below the Bid price at the time you change the order. Make sure to compare the changed price to the GetCurrentBid() value to make sure you are not changing the order below the market.

    Kind regards,
    -ChrisL

    Comment


      #3
      ok thanks.

      I'm trying to make sure I only change the price of an order that hasn't yet been executed (Filled = 0). So I can wait for that price to arrive (or not). Would that make a difference?

      I also use GetRealtimeOrder if state changes to realtime.

      Comment


        #4
        can we leave this for now, what I thought was a flat market may not be and I could be trying to change an order that has been executed.

        Comment


          #5
          I think were I'm going wrong is knowing what state an order "myOrder" is in after it has been created

          e.g. (A) null, (B) created and waiting to be filled (in this state I can change the limit price), (C) filled (now I don't want to change the limit price) and then (D) closed by a profit target or stoploss and then (E) back to null.

          I know this is a lot to ask but any tips or advice appreciated..
          Last edited by dibDab; 11-21-2022, 11:09 AM.

          Comment


            #6
            Hi, thanks for the follow up. You can keep track of an order's state by using the OnOrderUpdate event method. The order must be in Working state to be changed, After Filled state is too late. We have an example of advanced order handling techniques here on this page for reference:



            Kind regards,
            -ChrisL

            Comment


              #7
              thanks again

              can I clarify ...

              if (myLongOrder != null && myLongOrder.OrderState == OrderState.Working) then Stop price can't be changed below the GetCurrentBid()

              if (myShortOrder != null && myShortOrder.OrderState == OrderState.Working) then Stop price can't be changed above the GetCurrentAsk()

              Comment


                #8
                Hi, that looks correct to me.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by NullPointStrategies, Yesterday, 05:17 AM
                0 responses
                72 views
                0 likes
                Last Post NullPointStrategies  
                Started by argusthome, 03-08-2026, 10:06 AM
                0 responses
                143 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                76 views
                0 likes
                Last Post NabilKhattabi  
                Started by Deep42, 03-06-2026, 12:28 AM
                0 responses
                47 views
                0 likes
                Last Post Deep42
                by Deep42
                 
                Started by TheRealMorford, 03-05-2026, 06:15 PM
                0 responses
                51 views
                0 likes
                Last Post TheRealMorford  
                Working...
                X