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 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