Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

One Trade per Setup

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

    #16
    Thanks NinjaTrader_ChelseaB
    I meant like a regular snippet from an unlocked script. This is a bit confusing.

    I was thinking more like:
    if condition1 then bool = true

    if bool = true and other conditions then enter trade and bool = false.

    Will this be same as the Builder example?

    Comment


      #17
      Hello Trader17,

      Yes, this is basically like the example. Resetting in the second event conditions would be fine.

      I recommend giving it a try and print the value of the bool with the time of the bar so you can see how this is being changed.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #18
        Thank you NinjaTrader_ChelseaB

        And would you use 2 bools in this case? Because event to go long might not trigger say a trade and event to go short might become true. How would you avoid taking long on old signal? Wait for next long event trigger to look for new trades.

        Comment


          #19
          Hello Trader17,

          Using one bool would likely be sufficient. Using two bools gives further control of when to reset after both events have occurred.

          "How would you avoid taking long on old signal?"

          In the condition for the first event, check the bool is false. In the second event check the bool is true.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #20
            Thanks NinjaTrader_ChelseaB

            Or what about using 2 bools for the 2 events, one for long and one for short? If event1, set it to true and set event2 to false and vice versa.
            And once a trade is taken in either set it to false? This way we event1 or event2 do not take trade on last cycle but most current. Makes sense?
            So a strategy executes everything so fast in order?

            Comment


              #21
              Hello Trader17,

              You could consider either the long or short condition to be the first event and use a single bool. Both conditions would require the bool to be false. If either condition sets the bool to true, nether first event would trigger until the bool is set back to false.

              If you wanted the events to be separate and able to trigger while the other is working, use two bools, one for long one for short.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #22
                Originally posted by NinjaTrader_ChelseaB View Post
                Hello Trader17,

                You could consider either the long or short condition to be the first event and use a single bool. Both conditions would require the bool to be false. If either condition sets the bool to true, nether first event would trigger until the bool is set back to false.

                If you wanted the events to be separate and able to trigger while the other is working, use two bools, one for long one for short.
                Thanks NinjaTrader_ChelseaB

                What does the first para say that neither first event will trigger?

                I was thinking use 2 bools for the 2 events and when one is true the other is false by default. Then when a trade occurs with the true bool we set it back to false to avoid any more trades until it becomes true again via the next event setup. Makes sense?

                Comment


                  #23
                  Hello Trader17,

                  "What does the first para say that neither first event will trigger?"

                  I'm not quite sure what you are asking.

                  The first condition for long or the first condition for short would be the first event. These conditions would require the bool to be false.
                  Because the bool is false, this means neither condition has set the bool to true, so neither event has occurred.
                  If one condition is true, and sets the bool to true, then the first event has occurred. Both first conditions (long or short) require the bool to be false. This means after one condition has set the bool to true, neither first condition will evaluate as true until the bool is set back to false.

                  "I was thinking use 2 bools for the 2 events and when one is true the other is false by default. Then when a trade occurs with the true bool we set it back to false to avoid any more trades until it becomes true again via the next event setup. Makes sense?"

                  I encourage you to give it a try and see if this behavior you are looking for.
                  Add debugging prints to confirm the bool is being changed how and when you want.
                  Chelsea B.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by NullPointStrategies, Yesterday, 05:17 AM
                  0 responses
                  66 views
                  0 likes
                  Last Post NullPointStrategies  
                  Started by argusthome, 03-08-2026, 10:06 AM
                  0 responses
                  141 views
                  0 likes
                  Last Post argusthome  
                  Started by NabilKhattabi, 03-06-2026, 11:18 AM
                  0 responses
                  75 views
                  0 likes
                  Last Post NabilKhattabi  
                  Started by Deep42, 03-06-2026, 12:28 AM
                  0 responses
                  46 views
                  0 likes
                  Last Post Deep42
                  by Deep42
                   
                  Started by TheRealMorford, 03-05-2026, 06:15 PM
                  0 responses
                  51 views
                  0 likes
                  Last Post TheRealMorford  
                  Working...
                  X