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 jxs_xrj, 01-12-2020, 09:49 AM
      6 responses
      3,290 views
      1 like
      Last Post jgualdronc  
      Started by Touch-Ups, Today, 10:36 AM
      0 responses
      8 views
      0 likes
      Last Post Touch-Ups  
      Started by geddyisodin, 04-25-2024, 05:20 AM
      8 responses
      61 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by Option Whisperer, Today, 09:55 AM
      0 responses
      8 views
      0 likes
      Last Post Option Whisperer  
      Started by halgo_boulder, 04-20-2024, 08:44 AM
      2 responses
      24 views
      0 likes
      Last Post halgo_boulder  
      Working...
      X