Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BarsSinceExit

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

    BarsSinceExit

    I need some help in inderstanding how to reference not my last exit of a trade, but the one before it. I read the manual which states I must use the BarsInProgress index. I'm sorry, but my lack of programming experience leaves me at a loss for this. I'm trying to debug with this line;

    PrintWithTimeStamp("This Long = " + BarsSinceExit(0,"Long",1).ToString() + " " + "Last Long = " + BarsSinceExit(0,"Long",2).ToString() );

    This is a single time frame strategy, so I understood the first "0" in the BarsSinceExit refers to the time frame being used. This however is not working. Is there a short answer to this, or a code snippet you could direct me to so that I can reference the number of bars between trades?

    Thanks,

    Safetrading

    #2
    Hello Safetrading,
    You will be able to get the bar number of the prior last exit. Please use the below overload to do it
    BarsSinceExit(int barsInProgressIndex, string signalName, int exitsAgo)


    The exitAgo property determines the number of exits ago.

    A sample code will be
    Code:
    Print(BarsSinceExit(0, "", 1));  //1 determines its the prior last exit.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Thanks

      Thanks so much, just what I needed to get going.

      Originally posted by NinjaTrader_Joydeep View Post
      Hello Safetrading,
      You will be able to get the bar number of the prior last exit. Please use the below overload to do it



      The exitAgo property determines the number of exits ago.

      A sample code will be
      Code:
      Print(BarsSinceExit(0, "", 1));  //1 determines its the prior last exit.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      72 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      44 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      26 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      30 views
      0 likes
      Last Post TheRealMorford  
      Started by Mindset, 02-28-2026, 06:16 AM
      0 responses
      61 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Working...
      X