Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

entry orders keep happening

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

    #16
    ..how long does the "false" last for? is it just for one bar?

    you typed is it first tick of bar earlier. do i need to put that somewhere in the strategy. or, just the bool is enough?

    Comment


      #17
      Hello SteveReiza,

      The bool will remain false until it's assigned a true value.
      I've suggested to set to back to true on the first tick of a new bar to allow new orders on a new bar.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #18
        ..you typed if (IsFirstTickOfBar) earlier in the thread. do i need that somewhere in the strategy? or, is that bool you gave an example of all this is needed?

        Comment


          #19
          Hello SteveReiza,

          IsFirstTickOfBar is true after a bar closes and a new bar opens. If you want to reset the bool so a new order can be submitted on a new bar, then reset the bool when IsFirstTickOfBar is true.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #20
            thanks for the replies. okay sweet. this is where i am with a stop loss i'm working on. i don't know how to reset a bool. can you offer guidance? where do i put the isfirsttickofbar? i see it in the options to be selected in the strategy builder.

            Comment


              #21
              Hello SteveReiza,

              If the bool started as false, and was assigned a value of true, set this to false to reset it.
              If the bool started as true, and was assigned a value of false, set this to true to reset it.

              Code:
              private bool myBool;
              
              if (myBool == true && IsFirstTickOfBar == true)
              {
              myBool = false; // reset bool to false on first tick of new bar
              }
              
              if (myBool == false && Close[0] > Open[0])  // require the bool to be false to allow an entry
              {
              EnterLong();
              myBool = true; // after calling an entry method set the bool to true to prevent further orders until reset back to false
              }
              In this sample myBool is a bool that starts as false. The entry condition requires the bool to be false and places an order and changes the bool to true. On the first tick of a new bar the bool is reset back to false to allow a new order. This sample would allow only one entry method to be called per bar.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #22
                thanks for the reply. okay sweet. i think i'm tracking.

                i did it in the strategy builder as another set. is that okay? does it need to be in front or can it be after everything?
                Attached Files

                Comment


                  #23
                  Hello SteveReiza,

                  The conditions sets are evaluated independently and in order.
                  This should be the first condition set if you want the bool reset for the subsequent conditions on the same bar pass.
                  (You can drag and drop the set tabs to re-order them)
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #24
                    thanks for the reply. okay sweet. i'll do that!

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    612 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    355 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    105 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                    0 responses
                    561 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    564 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X