Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Maintaining limit orders

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

    Maintaining limit orders

    Hi

    I've got a problem. A part of my current code looks like this:


    if
    (ToTime(Time[0]) >= ToTime(17, 05, 0)
    && ToTime(Time[
    0]) < ToTime(22, 15, 0)
    && Close[X
    ] > Open[X]
    && Close[X
    ] - Open[X] > 1

    && Position.MarketPosition != MarketPosition.Short
    && ToTime(Time[
    0]) % 500 == 0)
    {
    EnterShortLimit(DefaultQuantity, X
    , "");
    SetProfitTarget(CalculationMode.Price,plus());
    }
    The X things don't have to matter for now. I'm working with 10 second bars, so this means, every 5 minutes, there shall be a check, if I enter short. So long, so good.
    Now I have observed, that - if the order haven't got filled until the open of the next 10 seconds bar - the order gets cancelled.
    Now I wanted to ask, how it is possible, to maintain the order. My aim is, that every 5 minutes, there shall be a limit order, which stays until the next 5 minutes have begun. Can you follow me? So the order should get filled anywhen between these 5 minutes, but with the parameters set at the beginning of the 5 minutes - I hope you know what I mean.
    If necessary: I've set on "Calculate on bar close = true" during realtime simulation. Perhaps this has something to do with it.

    Best Regards,

    Sepp

    #2
    Sepp,

    Use the signature with liveUntilCancelled = true to keep the order alive.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thank you, that was what I was looking for!

      Comment


        #4
        Is there a possibility, to keep the order alive, but only for a certain time? For example, after 5 minutes, cancel all orders? What's the command for this?

        Regards,

        Sepp

        Comment


          #5
          Originally posted by MasterSepp View Post
          Is there a possibility, to keep the order alive, but only for a certain time? For example, after 5 minutes, cancel all orders? What's the command for this?

          Regards,

          Sepp
          You would have to self-code this.
          RayNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

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