Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Only one entry per bar?

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

    Only one entry per bar?

    Hello,

    I am testing my strategy using the Playback connection, and everything appears to be working well, but I am having one small issue. If a single bar which triggers my entry also grows long enough to trigger all of my exits, the entry conditions still exist, and it immediately jumps back into another entry during that same bar. I don't want that to happen. I want it to wait at least until that bar closes before it starts looking for the conditions for a new entry.

    I know about IsFirstTickOfBar, but that won't work, because, obviously, I want to be able to enter and exit within the same bar. And I can't use the Maximum Entries per Direction, because I've actually exited at that point.

    Does anyone have any suggestions about how to get it to ignore entry conditions that may be still be present if there have already been trades within that bar?

    Thanks in advance!

    #2
    Hello NjMatthew,

    Thank you for your inquiry.

    You can use a bool to determine when it is OK to enter a new trade. Require the bool to be true in order to enter a new position. Set the bool to false after entering, and reset the bool back to true after your exit.

    Please let us know if you have any further questions.

    Comment


      #3
      Originally posted by NinjaTrader_Gaby View Post
      Hello NjMatthew,
      You can use a bool to determine when it is OK to enter a new trade. Require the bool to be true in order to enter a new position. Set the bool to false after entering, and reset the bool back to true after your exit.
      I actually set it up the opposite way. I have a boolean that is false when I am not in a trade, and is true when I have an open position. Absolutely irrelevant to the function of the algorithm, I know, but I just wanted to let you know that it works now.

      Thank you!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      80 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      40 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      63 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      63 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      54 views
      0 likes
      Last Post CarlTrading  
      Working...
      X