Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bars Since Exit not working

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

    Bars Since Exit not working

    I have a simple SMA cross strategy but I am trying to avoid whipsaws by using BarsSinceExit() on a named entry, but it is not working. I am using Better Renko bars on a single instrument with Better Renko Bars. Below is my code and screenshot:

    if(CrossAbove(SMA(2), SMA(9), 1)
    && (BarsSinceExit("Short-1") > 2 || BarsSinceExit("Short-1") == -1)
    )
    {
    EnterLong(1, "Long-3");
    }
    Attached Files

    #2
    Hello Billy Valentine,
    Unfortunately I could not replicate the scenario. If I Print our the values of BarsSinceExit("entry order name") I can get a valid print out.

    To assist you further can you please send a toy NinjaScript code* replicating the behavior to support[AT]ninjatrader[DOT]com

    Please append Attn:Joydeep in the subject line of the email and give a reference of this thread in the body of the email.

    I look forward to assisting you further.

    *The "toy" just means something that is a stripped down version that isn't necessarily the whole logic. It makes things easier to rout out.
    JoydeepNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    67 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    36 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    60 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    62 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    53 views
    0 likes
    Last Post CarlTrading  
    Working...
    X