Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trade Exit After 1 Entry Bar on Swing High Indicator

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

    Trade Exit After 1 Entry Bar on Swing High Indicator

    Hi,

    I'm doing an EMA Cross Exit Strategy via Strategy Builder where the trade exits when, price/bar crosses above the Swing High. Often, I see it close 1 bar after entry.

    Is there a way in the building strategy to ignore the last swing high on the next bar? I tried to use the Bars ago parameter and still happens

    Below is my code and screenshots of the exits.

    if (
    // When Price is Greater than Swing High
    ((Close[0] >= Swing1.SwingHigh[0])
    && (CurrentBars[0] != SavedBar))
    // SMA 50 Below SMA200
    || ((CrossBelow(SMA1, SMA2, 1))
    && (CurrentBars[0] != SavedBar)))
    {
    ExitLong(Convert.ToInt32(DefaultQuantity), "", "");
    SavedBar = Convert.ToInt32(CurrentBars[0]);
    }

    Thank you in advance.​

    #2
    Hello twistedheart,

    As a heads up, the Swing indicator changes its previous bar values.

    You can check the .SwingHighBar and .SwingLowBar to see if the swing has changed.

    Below is a link to the help guide.
    https://ninjatrader.com/support/help.../nt8/swing.htm

    To understand why the condition is evaluating as true or false, print the time of the bar and all values used in the condition along with labels for each value and comparison operator.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    89 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    135 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    119 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    69 views
    0 likes
    Last Post PaulMohn  
    Working...
    X