Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 Rapine Heihei, Today, 08:19 PM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by Rapine Heihei, Today, 08:25 PM
          0 responses
          6 views
          0 likes
          Last Post Rapine Heihei  
          Started by f.saeidi, Today, 08:01 PM
          1 response
          9 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by Rapine Heihei, Today, 07:51 PM
          0 responses
          8 views
          0 likes
          Last Post Rapine Heihei  
          Started by frslvr, 04-11-2024, 07:26 AM
          5 responses
          98 views
          1 like
          Last Post caryc123  
          Working...
          X