Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

When profit target hit on the same candle as entry, how to prevent a 2nd entry?

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

    When profit target hit on the same candle as entry, how to prevent a 2nd entry?

    I am using Strategy Builder, and ran into this issue -

    1) Conditions are met for trade entry and an entry by the system with profit target and stop loss orders attached.

    2) In that same candle, the profit target is hit

    3) However, entry conditions still apply, so NT then renters on the same bar.

    I am trying to prevent part three from happening - i.e.; only one entry is allowable per bar.

    Changing to UniqueEntries prevents multiple concurrent positions, not sequential ones, within the same bar.

    I thought about using BarsSinceEntry and setting it to greater than 0, but the issue is this will also prevent the first trade. Same problem if I use BarsSinceExit

    I would appreciate any help on this.​

    #2
    Hello anotherone1,

    Thank you for your post.

    It sounds like you could still use BarsSinceEntry or BarsSinceExit; on top of checking for a value greater than 0, you will also need to check if it is equal to -1. The value of -1 is returned if a previous entry/exit does not exist. For more info, please see the following help guide pages:Using this example from the help guide, here is a screenshot of what that would look like in the Strategy Builder:
    Code:
    // Only enter if at least 10 bars has passed since our last entry
    if ((BarsSinceEntryExecution() > 10 || BarsSinceEntryExecution() == -1) && CrossAbove(SMA(10), SMA(20), 1))
    EnterLong();

    Screenshot: https://www.screencast.com/t/KGE9Ts7K7T

    Please let me know if I may be of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    59 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    134 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
    45 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    50 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X