Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Finding the lows of new bars

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

    Finding the lows of new bars

    Is there a way for NT to find the lows of each 1 min bar, then placing a limit order below those bars after a crossover?

    #2
    I guess Im looking for a live until cancelled help, taking a look at it now...

    Comment


      #3
      chatchgo,

      Sure. What is your question for using liveUntilCancelled?

      You can check for lower lows through the use of MIN(Low, 10)[0] for instance. That would give you the lowest low for a 10 bar period.
      Josh P.NinjaTrader Customer Service

      Comment


        #4
        Hey Josh,

        Im trying to get NT to enter a limit order 2 ticks below the low of every bar after a crossover? Im not too sure how to program this, as Im new to writing programs

        Thanks in advance

        Comment


          #5
          Hi chatchgo, thank you for your inquiry.

          What you're trying to do is entirely possible within NinjaScript. You can access the low of each bar by referencing Low[x], where 'x' is the number of bars back. So if you want the low of the current bar, just take a look at Low[0].

          The next step would be to check for crossovers, which you can do with either CrossAbove or CrossBelow.

          Lastly, to place a limit order below the low of a bar, you could so something like this:
          EnterLongLimit(Low[0] - 2*TickSize, "buy below the low"). That would place a buy limit order at two ticks below the low of the current bar.

          Hopefully this gets you going in the right direction, but let us know if you're still having problems.
          AustinNinjaTrader Customer Service

          Comment


            #6
            Thx Austin, Ive gotten that far, now I need the order to stay live until filled...b/c everytime that order isnt filled it cancels itself and price runs away. I need the order to stay live, and keep trailing 2 ticks below the low of the future bar. I tried Low (-1), but that doesn't seem to work.

            Thanks in advance
            Last edited by chatchgo; 07-02-2009, 08:04 AM.

            Comment


              #7
              Chatchgo, have you taken a look at the liveUntilCancelled property of EnterLongLimit?
              AustinNinjaTrader Customer Service

              Comment


                #8
                Im not sure what to write in for the bool entry, can u show me an example possibly of a liveuntilcancelled entry?

                Comment


                  #9
                  Sure thing, EnterLongLimit(0, true, DefaultQuantity, LimitPrice, "buy signal"), where LimitPrice is your limit price, and "buy signal" is the signal name.
                  The "true" is all you need to set liveUntilCancelled.
                  AustinNinjaTrader Customer Service

                  Comment


                    #10
                    OK thx austin...that got the ball rolling. Now that the order stays live, how do I look for the next bar's low -2 ticks

                    Comment


                      #11
                      Chatchgo, I can outline for you what you can do to accomplish this, but I can't write all the code.

                      Ok, so when the order is first placed, all is fine and good.
                      The next bar (now the current bar) comes and the order is still active, yet the low of the current bar has changed.

                      This is where you have a few options. You can add some new logic to the OnBarUpdate section checking to see whether or not the order has been filled. If it hasn't, you can cancel it, and then resubmit a new order. Another option is to just modify the previous order.

                      I suggest taking a look at IOrders. It allows much greater control over orders, but is a complex subject to get a grasp of.
                      AustinNinjaTrader Customer Service

                      Comment


                        #12
                        EnterShortStop(0, true, 1, Low[0] + -2 * TickSize, "Short");
                        DrawVerticalLine(
                        "My vertical line" + CurrentBar, 0, Color.Red);


                        if (CurrentBar > 0 + 5)
                        CancelOrder (
                        "Short");

                        Im here in the process now Austin. But I can't figure out what name to call when I cancel order?? I tried to set a name to the the original entry order

                        (myEntryOrder = EnterLongLimit(0, true, 1, Low[0], "Long Entry");

                        But i get error on generating strategy...

                        Comment


                          #13
                          Chatchgo, I'll investigate this further and let you know.
                          AustinNinjaTrader Customer Service

                          Comment


                            #14
                            When calling CancelOrder, you need to specify the IOrder object, not a string value.

                            In your case, you could change your EnterShortStop to an IOrder object, and then cancel that.

                            Ex:
                            Code:
                            myShortOrder = EnterShortStop(0, true, 1, Low[0] + -2 * TickSize, "Short");
                            CancelOrder(myShortOrder)
                            

                            AustinNinjaTrader Customer Service

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by szferi, Today, 02:04 AM
                            0 responses
                            1 view
                            0 likes
                            Last Post szferi
                            by szferi
                             
                            Started by MidenThur, Today, 12:52 AM
                            0 responses
                            6 views
                            0 likes
                            Last Post MidenThur  
                            Started by seseoraf, Today, 12:51 AM
                            1 response
                            6 views
                            0 likes
                            Last Post charmingishagarg  
                            Started by Rosario, Today, 12:50 AM
                            0 responses
                            4 views
                            0 likes
                            Last Post Rosario
                            by Rosario
                             
                            Started by kemoyums, Today, 12:38 AM
                            0 responses
                            3 views
                            0 likes
                            Last Post kemoyums  
                            Working...
                            X