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 cre8able, Yesterday, 01:16 PM
      3 responses
      11 views
      0 likes
      Last Post cre8able  
      Started by ChartTourist, Today, 08:22 AM
      0 responses
      4 views
      0 likes
      Last Post ChartTourist  
      Started by LiamTwine, Today, 08:10 AM
      0 responses
      2 views
      0 likes
      Last Post LiamTwine  
      Started by Balage0922, Today, 07:38 AM
      0 responses
      5 views
      0 likes
      Last Post Balage0922  
      Started by JoMoon2024, Today, 06:56 AM
      0 responses
      6 views
      0 likes
      Last Post JoMoon2024  
      Working...
      X