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

entry orders keep happening

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

    entry orders keep happening

    my strategy reads a candle touch at bollinger line. then so many ticks from that on the next candle for entry. after the profit is hit. another order gets submitted. and it keeps doing that until i get an error message. same if it hits the stop. it submits another order immediately. how can i just make it to where its one order. its a read on a 5m chart. should i do on close rather than on tick for update?

    #2
    Hello SteveReiza,

    Are you wanting to ensure there is only one entry per bar?

    If so, use a bool. When the entry is submitted set the bool to true. On IsFirstTickOfBar set the bool back to false.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      yes that's what i'm looking for. just one entry per bar. i thought having it calculate on bar close would limit it to just one order per bar as it wouldn't calculate again until the next bar. its pretty sweet when it kept trending down. but when its not going short i'm getting hit with stop loss after stop loss. so, better to just keep it simple as one entry per read of the entry conditions.

      do you have an example of this?

      Comment


        #4
        Hello SteveReiza,

        private bool allowEntry;

        if (IsFirstTickOfBar)
        {
        allowEntry = true;
        }

        if (allowEntry == true && Close[0] > Open[0]) // entry conditions here
        {
        EnterLong();
        allowEntry = false;
        }
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          cool cool. many thanks! i'm trying to do this in strategy builder.

          i can set all of that in the first set? i need to define allowEntry don't I. what variable is that set to initially?
          Attached Files

          Comment


            #6
            Hello SteveReiza,

            This would be two conditions, so two condition sets.

            The bool would be added on the Inputs and Variables page in the Variables area.

            Please watch the 'Automate Your Trading with NinjaTrader's Strategy Builder' training video to become familiar with the Strategy Builder.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              thanks for the reply.

              why would that happen? i mean its kind of common sense that only one order should happen. instead of a continuous read of the entry conditions as the bar happens so orders keep taking place. i have to make that bool for only 1 trade to occur? i don't get why it would keep executing new trades. can you explain?

              Comment


                #8
                Hello SteveReiza,

                To understand behavior, it is necessary to use prints and TraceOrders.


                Either the condition is evaluating as true on every bar update, or there are historical overfills.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  some action doesn't happen at the first tick. its a short sale. so its calculating to -11 ticks. it could happen on the first tick. but, it could happen after too. as the price drops. does the bool still apply?

                  i imagine "EVERYONE" has this issue. who wants the trade to keep executing. it doesn't make sense to have that. so i bet everyone then has to make this bool. can i officially request a tutorial video be made as how to do this in the strategy builder. there isn't one person building a script who wouldn't watch this. you would think this bool would come "pre-formatted" in the strategy in the strategy builder. there isn't an exception that wouldn't want it, am i right?

                  Comment


                    #10
                    Hello SteveReiza,

                    The bool is being reset on the first tick of a new bar so that a new order can be made. Once a new order is made the bool is changed so no further orders can be placed until a new bar opens and the bool is reset.
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      thanks for the reply. alright, sweet.

                      is there a way to keep it as is but stop the executions once a stop loss is hit. its cool that it keeps running with profit. but, when it starts descending it keeps executing orders too. so, i'll get 3-4 stop losses. i can eat one. especially after 3-4 profit runs. i just want it to halt after that first stop loss.

                      Comment


                        #12
                        Hello SteveReiza,

                        Is there a profit target or other order that could fill to close the position?
                        If not, you could use that same bool and never reset it back to true. After placing the entry the bool would be changed and no further orders would be submitted.

                        If there is a profit target, the script would need to be unlocked and coded by hand, and is OnExecutionUpdate() a condition to check the execution.Name would be used to determine which order has filled. If the 'Stop loss' filled, then the bool would be set to false.
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #13
                          right on, that's cool. thanks for the reply.

                          its a little over my head. i'll have an ecosystem developer dial it in for me. unless, you can make a tutorial video on the basic stop executing after one entry??

                          Comment


                            #14
                            Hello SteveReiza,

                            To allow one entry, in the Strategy Builder add a bool variable that defaults to true, set the bool to false in the actions and submit the order. Require the bool to be true in the condition.

                            Below is the video you requested.
                            Chelsea B.NinjaTrader Customer Service

                            Comment


                              #15
                              man that's awesome! thank you so much!

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by burtoninlondon, Today, 12:38 AM
                              0 responses
                              10 views
                              0 likes
                              Last Post burtoninlondon  
                              Started by AaronKoRn, Yesterday, 09:49 PM
                              0 responses
                              14 views
                              0 likes
                              Last Post AaronKoRn  
                              Started by carnitron, Yesterday, 08:42 PM
                              0 responses
                              11 views
                              0 likes
                              Last Post carnitron  
                              Started by strategist007, Yesterday, 07:51 PM
                              0 responses
                              14 views
                              0 likes
                              Last Post strategist007  
                              Started by StockTrader88, 03-06-2021, 08:58 AM
                              44 responses
                              3,983 views
                              3 likes
                              Last Post jhudas88  
                              Working...
                              X