Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Limit order resubmit/cancel

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

    Limit order resubmit/cancel

    I've spent a lot of time reading forum posts about limit orders, but can't seem to resolve keeping the orders alive. After the entry signal the strategy submits the limit order
    EnterLongLimit(0, true, 10000, GetCurrentAsk() -0.0020, "Long1")
    How can I keep it alive at the original entry price for 10 bars? After 10 bars I'd like to update the limit price to the current bar. Any help would be appreciated. With market orders the strategy works, automatically reversing position when a new signal is generated. Changing to limit orders has meant that they need to resubmitted, but also it hasn't submitted the new orders if a new signal is generated.
    E.g. If a short signal is generated, I want to cancel all long limit orders, and long positions and submit short limit orders.
    Last edited by Matts; 12-14-2009, 07:20 PM.

    #2
    Matts,

    When you are using the liveUntilCancelled = true bool you do not want to keep resubmitting the order to keep it alive. It will stay live once submitted indefinitely till it gets filled or is cancelled by you or by the Time in Force settings. Doing so will preserve the original price throughout too.

    If you want to cancel it and start going short you should use CancelOrder(). Be sure to wait till it is completely cancelled before submitting your short orders.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thanks Josh, this has helped me to understand it better. I'm now getting the limit orders to fill and the position reverses, but I'm having trouble getting the orders to cancel if they're not filled. The log is stating "Object reference not set to an instance of an object".

      Comment


        #4
        Just make it without liveUntilCancelled = true
        EnterLongLimit(Price, "Long1")
        That way you need to resubmit it on each bar. After 10 bar you change the Price.

        Baruch

        Comment


          #5
          This is what I tried to do originally, but couldn't get it to resubmit How to code it to resubmit?
          At the moment the limit order expires after 1 bar, unless liveUntilCancelled =true;

          Comment


            #6
            You need that this line be executed on each bar.

            Comment


              #7
              Not on each bar. After profit targets are hit, I don't want any orders placed until the next entry signal. This is why the other method is the best. The only problem is with cancelOrder, because it is causing a conflict of some sort.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              649 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              370 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              109 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              573 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              576 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X