Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Auto order Entry with certain conditions

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

    Auto order Entry with certain conditions

    hi,

    i am trying to program a strategy with the wizard that will automatically enter a long or short position when the price is a certain # of tics from a starting price. For example, if the starting current price is 1100.00, then if the price rises to 1100.75 (3 tics), i want NT to automatically enter a short position with one contract.

    i have attached some screen shots of what i did. it does not work so far. can you advise as to what i am doing wrong and what might fix it?

    Thx

    eric
    Attached Files

    #2
    Hello Eric,

    The fill isn't going to happen because you're adding the current bid to your variable current price. This value will equal 2200+. You're then comparing it to a value around 1100.

    On the condition builder you will want to select a reasonable price input on the left. This could be Bid, Ask, or Close but not offset by 1100 points.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Ahhh...right. ok - so i set the offset back to 0. and still does not work. wondering if i need to do something to let NT know that the start price is 1100.00 and so when it gets 3 ticks away from 1100.00 it will put an order in for me. am i thinking right? how would i do that?

      eric

      Comment


        #4
        Hi Eric,

        You can use EnterShort() after a conditional statement like:

        Code:
         
        if (Close[0] == 1100.75)
           EnterShort();
        If the last traded price equals 1100.75 then enter short. If you want to work with your CurrentPrice, then:

        Code:
         
        if (Close[0] == CurrentPrice + TickSize * 3)
           EnterShort();
        Condition Builder - Price Data Comparisons
        Last edited by NinjaTrader_RyanM1; 02-19-2010, 12:53 PM.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          thanks. is there a way to do this with the wizard?? if not what would be the best way to write this after unlocking the code?

          thanks for your excellent help.

          EG

          Comment


            #6
            Hello Eric,

            Yes, it can be done in the wizard. The link there goes over working with price data in the condition builder. The next article discusses using offsets.





            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              Ok - this works! now, how would i write it so that it will only happen once during the life of the strategy (until i use the strategy the next time)? do you know what i mean?

              Eg

              Code:

              if (Close[0] == CurrentPrice + TickSize * 3)
              EnterShort();

              Comment


                #8
                Hi Eric,

                I answered a similar question yesterday. Here's the thread:
                Support for the development of custom automated trading strategies using NinjaScript.


                Most likely won't be possible using only the condition builder.
                Ryan M.NinjaTrader Customer Service

                Comment


                  #9
                  Ryan,

                  thanks for the concept - how would i apply this to the current conditions i have written so that it only enters and order one time at that price? here is the condition that i have written so far.

                  if (Close[0] == StartPrice + TickSize * 3)
                  EnterShort();
                  thanks

                  EG

                  Comment


                    #10
                    Hi Eric,

                    You can specify the quantity of the order.

                    EnterShort(int quantity)

                    Ryan M.NinjaTrader Customer Service

                    Comment


                      #11
                      are you saying that if i only want one order entered only one time at that price that i would type the following?:

                      EnterShort(int 1)

                      Comment


                        #12
                        Hi Eric,

                        No, that won't work. The "int quantity" just displays the input type expected, an integer. If you want to enter one order to Enter Short, you can use:
                        EnterShort(1);

                        The condition will continue to be evaluated on subsequent bars and enter based on the settings defined in the properties EntriesPerDirection and EntryHandling.

                        Ryan M.NinjaTrader Customer Service

                        Comment


                          #13
                          ok, i understand that. what i am after is after EnterShort(1) happens at that price, if the price moves up or down away from the entry price and then comes back to it again, i don't want it to EnterShort(1) again at that price.

                          so if the price hits 1100.00, say, the strategy will enter one short contract. then the price moves down to 1099.00, turns around and then come back up and hits 1100.00 again - when it does this, i DO NOT want the strategy to enter a short contract. i only want that to happen the first time the price hits 1100.00. Hope this makes sense.

                          how would i program this scenario?

                          thx
                          EG

                          Comment


                            #14
                            Hello Eric,

                            If you are currently in a short position and don't want to accept more signals to enter short, then this is managed with EntriesPerDirection and EntryHandling properties.

                            If you are currently flat and don't want to accept further entry signals beyond your first, one approach to this is covered in the thread I linked earlier.
                            Support for the development of custom automated trading strategies using NinjaScript.
                            Ryan M.NinjaTrader Customer Service

                            Comment


                              #15
                              its not that i don't want to accept any more order entries, i just don't want any more orders at the same price.

                              I would like to receive order entries to go short at 1100.00, 1101.00, and 1102.00 and each only once, no matter how many times the price retraces to these levels.

                              if i get filled short 1 ct at 1100.00, and then the price goes to 1099.00 and then goes to 1101.00, i don't want to receive another order at the 1100.00, but i do want to receive the first 1 ct order at 1101.00.

                              make sense what i am wanting? let me know what you think.

                              EG

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              648 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