Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to Put a Limit Order above and below opening price of a Candle Session.

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

    How to Put a Limit Order above and below opening price of a Candle Session.

    Can anyone please tell me how to

    1. Put a Long Limit order 'x' ticks below the opening price of current session. Let's assume that the market is not moving so fast that it would immediately come down x ticks from the opening price of current session.

    Please tell me how to do this.

    The Entry is always relative to the opening price of the current session. Please advice.

    #2
    Hello,

    The quickest way to do this would be to call the Current Day OHL indicator method, then add "- X * TickSize", where X represents the number of ticks. For example, you might do something like:

    Code:
    EnterLongStop(CurrentDayOHL().CurrentOpen[0] - 5 * TickSize);
    For more information on the Current Day OHL indicator, please see the link below:

    http://www.ninjatrader.com/support/h...nt_day_ohl.htm

    Please let me know if I can assist further.
    Dave I.NinjaTrader Product Management

    Comment


      #3
      Thanks Dave.

      But I want to do this on a 1 hr chart. How do I do that ? I mean, I want to put a long limit below the opening price of the CURRENT 1 hr session's opening price.

      Originally posted by NinjaTrader_Dave View Post
      Hello,

      The quickest way to do this would be to call the Current Day OHL indicator method, then add "- X * TickSize", where X represents the number of ticks. For example, you might do something like:

      Code:
      EnterLongStop(CurrentDayOHL().CurrentOpen[0] - 5 * TickSize);
      For more information on the Current Day OHL indicator, please see the link below:

      http://www.ninjatrader.com/support/h...nt_day_ohl.htm

      Please let me know if I can assist further.

      Comment


        #4
        This should do the trick, as long as you are looking at a one-hour chart. The CurrentDayOHL() indicator should pull the OHL of the first candle of the session. So on a one-hour chart, it will pull the OHL of the first one-hour bar of the current session.

        If you feel that it is not pulling the correct data, I recommend adding a few Prints to your code to test the values that the CurrentDayOHL() method is giving you.
        Dave I.NinjaTrader Product Management

        Comment


          #5
          Thanks Dave.

          How should I put two orders, one above current session open and one below at 'x' no. of ticks. When I put two orders Enter Long Limit and Enter Short Limit, I am seeing that the first statement is being considered while the second is being ignored.

          I want both orders to be active waiting to be filled. How to do this ?
          '

          Comment


            #6
            You won't be able to do that with the managed approach. The system only allows orders of the same direction per the internal rules -
            http://www.ninjatrader.com/support/h...d_approach.htm

            You would need to switch to the Unmanaged approach if you want to create a breakout order setup

            Comment


              #7
              Hi Calonious,

              That's something new for me... Interesting stuff.. thanks.

              Will it be possible to put the two orders as OCO orders ?

              I also want the order that is filled (in the above situation) to be an ATM Strategy based order so that the stop and target are predetermined.

              Will it be possible to achieve this in unmanaged approach ?

              Originally posted by Calonious View Post
              You won't be able to do that with the managed approach. The system only allows orders of the same direction per the internal rules -
              http://www.ninjatrader.com/support/h...d_approach.htm

              You would need to switch to the Unmanaged approach if you want to create a breakout order setup

              Comment


                #8
                ATM's are whole new entity of their own. They don't follow any internal tracking from the strategy. They are basically submit and let them run. There is some functionality to get info from them -
                http://www.ninjatrader.com/support/h...gy_methods.htm

                However, you can take Unmanaged approach and submit OCO tied orders and then use the appropriate methods, such as OnOrderUpdate() and OnExecution() to detect fills and submit protective orders for it.

                There is a reference sample on using these methods to submit the protective orders, it is in managed approach for the orders but the logic remains the same -
                http://www.ninjatrader.com/support/f...ead.php?t=7499

                Comment


                  #9
                  Until now, I was trying to put a buy limit order below the current market price and sell limit order above the market price.

                  It worked well using the sumbitorder in unmanaged approach.

                  Now, my strategy needs to put a buy order 10 ticks above the current market price and a sell order 10 ticks below the current market price. (preferably a limit order)

                  Code:
                  shortEntry 	= SubmitOrder(0, OrderAction.SellShort, OrderType.Limit, 1, Open[-1]+10*TickSize, 0, "entry", "Short entry");
                  
                  longEntry = SubmitOrder(0, OrderAction.Buy, OrderType.Limit, 1, Open[-1]-10*TickSize, 0,  "entry", "Long entry");
                  This is what I used to put LIMIT orders below (for buy) and above (for sell) the market price.

                  Now, I want to put a buy order 10 ticks ABOVE current market price and sell order 10 ticks BELOW the current market price.

                  i tried by changing OrderType.Limit to OrderType.StopLimit and OrderType.Stop and changed Open[-1]-10*TickSize to Open[-1]+10*TickSize and vice versa in the above code because I want buy order above market price and sell order below the market price.. . But I am getting this annoying error all the time. Please see the error image.

                  The strategy is autodisabling after showing this error. It says i am trying to put a buy stop order @ price =0 ?!? But I am not... I clearly mentioned the price where to put the orders using Open[-1]+10*Ticksize... Why is this happening...?!?

                  Please help how to implement my idea.
                  Attached Files

                  Comment


                    #10
                    I understand that it is possible to put a BuyStopLimit or BuyStop above current market price and SellStopLimit or SellStop order below the current market price. I tried them but ninjatrader is thinking that I am asking it to put a buystop /buystoplimit order at Price =0!!! What is happening!!!

                    Comment


                      #11
                      That certainly sounds odd. Can you please provide me with a full export of your code, so that I can test to see what is happening? You can send it to platformsupport [at] ninjatrader [dot] com, and reference ticket # 1298659
                      Dave I.NinjaTrader Product Management

                      Comment


                        #12
                        Originally posted by karthik007 View Post
                        Until now, I was trying to put a buy limit order below the current market price and sell limit order above the market price.

                        It worked well using the sumbitorder in unmanaged approach.

                        Now, my strategy needs to put a buy order 10 ticks above the current market price and a sell order 10 ticks below the current market price. (preferably a limit order)

                        Code:
                        shortEntry 	= SubmitOrder(0, OrderAction.SellShort, OrderType.Limit, 1, Open[-1]+10*TickSize, 0, "entry", "Short entry");
                        
                        longEntry = SubmitOrder(0, OrderAction.Buy, OrderType.Limit, 1, Open[-1]-10*TickSize, 0,  "entry", "Long entry");
                        This is what I used to put LIMIT orders below (for buy) and above (for sell) the market price.

                        Now, I want to put a buy order 10 ticks ABOVE current market price and sell order 10 ticks BELOW the current market price.

                        i tried by changing OrderType.Limit to OrderType.StopLimit and OrderType.Stop and changed Open[-1]-10*TickSize to Open[-1]+10*TickSize and vice versa in the above code because I want buy order above market price and sell order below the market price.. . But I am getting this annoying error all the time. Please see the error image.

                        The strategy is autodisabling after showing this error. It says i am trying to put a buy stop order @ price =0 ?!? But I am not... I clearly mentioned the price where to put the orders using Open[-1]+10*Ticksize... Why is this happening...?!?

                        Please help how to implement my idea.
                        Probably cause you are using a negative index for the open price. What is your goal here for the price?

                        Comment


                          #13
                          @Calonius

                          No, I tested with Close[1] and Close[0] Same error! Will be mailing platform support.

                          Comment


                            #14
                            Found my mistake! Semantic Error!!!!

                            Had Ninjatrader manual been more extensive with lots of examples... (blame game )

                            I hope you guys will include MORE EXAMPLES...... in NT8 manual atleast!!

                            Thanks Calnious and Dave...

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by algospoke, Yesterday, 06:40 PM
                            2 responses
                            19 views
                            0 likes
                            Last Post algospoke  
                            Started by ghoul, Today, 06:02 PM
                            3 responses
                            14 views
                            0 likes
                            Last Post NinjaTrader_Manfred  
                            Started by jeronymite, 04-12-2024, 04:26 PM
                            3 responses
                            45 views
                            0 likes
                            Last Post jeronymite  
                            Started by Barry Milan, Yesterday, 10:35 PM
                            7 responses
                            20 views
                            0 likes
                            Last Post NinjaTrader_Manfred  
                            Started by AttiM, 02-14-2024, 05:20 PM
                            10 responses
                            181 views
                            0 likes
                            Last Post jeronymite  
                            Working...
                            X