Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Limit orders

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

    Limit orders

    I need to be able to cancel limit orders that are not filled. I am using the wizard. I am sure this is easy, but I am new to this and its not jumping out at me.

    #2
    If you do not resubmit your limit order on the next bar it will automatically cancel.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Hmm...must be something else causing this then. It didn't do this in backtesting, but it does seem to be leaving those orders in place after the bar closes. I probably screwed it up somewhere else. Thanks.

      Comment


        #4
        Let us say you have a simply condition for your limit order.
        Code:
        if (Close[0] > Open[0])
        At every bar, if this condition is true it will resubmit your limit order. If you previously had a limit order in place it will work to keep it alive. The moment this condition is no longer true, NT will not resubmit your limit order. If the limit order does not get the resubmission it will be cancelled. You are likely having your condition kept alive.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Sorry, what I meant is a stop order, not a limit. I am looking for 3 down bars and then an up bar at which point I want to buy 5 ticks above the high of the up bar, which I use a buy stop with a offset of 5 from the high of the last bar.

          Comment


            #6
            Hello,


            Try something like this:

            if(Open[1] < Close[1] && Open[2] > Close[2] && Open[3] > Close[3] && Open[4] > Close[4])
            {
            EnterLongStop(DefaultQuantity, High[1] + 5 * TickSize, "")
            }

            Now, when the new bar forms after this order is placed, your order will be cancelled automatically.

            Note: I am not using the current bar in my code, which you may or may not want to do. The auto cancelling functionality will not change however.
            DenNinjaTrader Customer Service

            Comment


              #7
              Pretty much what I have. But that bring me to something else. The "current bar" is (0) but if you are using calculate on bar close then are you really using the current bar to place an order against or the last bar closed? When I tried it the way you describe I was always one bar too far in the past.

              I am using exactly what You have there except I have the Open[0] < Close[0]. This confused me at first since how do you have a Close of the current bar? Once a bar closes, isn't it no longer the current bar? I decided to ignore this since it seemed to work fine...

              Comment


                #8
                Hello,

                The current bar is the currently closed bar. So Close[0] refers to the most recently closed bar close value.

                You will probably want to shift all of the index values up (from my code: [1] to [0]) by one if CalculateOnBarClose is set to true.

                So what you probably want is:
                if(Open[0] < Close[0] && Open[1] > Close[1] && Open[2] > Close[2] && Open[3] > Close[3])
                {
                EnterLongStop(DefaultQuantity, High[1] + 5 * TickSize, "")
                }
                DenNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by DJ888, Yesterday, 06:09 PM
                2 responses
                9 views
                0 likes
                Last Post DJ888
                by DJ888
                 
                Started by jeronymite, 04-12-2024, 04:26 PM
                3 responses
                40 views
                0 likes
                Last Post jeronymite  
                Started by bill2023, Today, 08:51 AM
                2 responses
                16 views
                0 likes
                Last Post bill2023  
                Started by sidlercom80, 10-28-2023, 08:49 AM
                167 responses
                2,260 views
                0 likes
                Last Post jeronymite  
                Started by warreng86, 11-10-2020, 02:04 PM
                7 responses
                1,362 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Working...
                X