Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BarsSinceExit

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

    BarsSinceExit

    Can anyone please show me the proper syntax for using BarsSinceExit() to identify a an exit PRIOR to the last trade? In the instructions it simply says to "pass in 0 for the number of bars since the last exit". So I used this;

    BarsSinceExit(1)

    however, I get an error when compiling, "can not convert from int to string". So then I tried this;

    BarsSinceExit("1")

    this will compile, but when I run my strategy and have this in my print statement for debugging purposes, it always shows " -1 ", even after severa trades, as if no trades have been exited.

    Thanks,

    Safetrading

    #2
    safetrading,

    BarsSinceExit(string signalName)

    This string is a signal name, so it ties the number to a specific order :

    EnterLong(string signalName)

    If you are trying to use the BarsInProgress overload, this is the proper method :

    BarsSinceExit(int barsInProgressIndex, string signalName, int exitsAgo)

    Adam P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    68 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    38 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    62 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