Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bars since exit multiple signal names

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

    Bars since exit multiple signal names

    I am using the strategy builder

    I have a strategy with 3 possible exits.

    "Profit target" and the "Stop loss" under the Stops and Targets window
    the 3rd is a conditional exit named "ATR LX"

    One condition is the bars since entry signal name = -1 to indicate there was no previous exit
    The other conditions would be the bar since exit signal name > 40 to indicate number of bars since exit
    I am having problems figuring out how to deal with the multiple signal names


    When I use bars since entry I use a group condition set to any
    bars since entry signal name = -1
    bars since entry signal name > 40

    Bars since entry works for me because I only have 1 entry name for the strategy.

    What would be the proper way to use bars since exit with multiple signal names?

    Thanks for any help





    #2
    Hi sdauteil,
    If you don't care about which signal triggered the exit, just leave the Exit Signal Name blank in the StrategyBuilder or put "" in NinjaScript.
    if (BarsSinceExitExecution(0, "", 0) > 20) // Did the last exit - no matter which one - occur more than 20 bars ago?
    { do something}
    By contrast, if you wanted to check the exit signals individually, use their individual name(s) like this:
    (BarsSinceExitExecution(0, @"ATR LX", 0) > 40) // Last ATR LX exit more than 40 bars ago ... (BarsSinceExitExecution(0, @"Profit target", 0) > 60) // Last Profit target exit more than 60 bars ago ...
    (BarsSinceExitExecution(0, @"Stop loss", 0) > 80)) // Last Stop loss exit more than 80 bars ago ...
    NT-Roland

    Comment


      #3
      Hello sdauteuil,

      The Strategy Builder will not allow for a conditional exit or any dynamic values with Set methods like SetStopLoss.

      Exit methods would have to be used instead.
      Below is a link to an example.


      NT-Roland is correct in that Bars since entry execution has a Signal name field. This would need to match the entry in question.

      You may also find this script on scaling out helpful.
      Chelsea B.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Today, 05:17 AM
      0 responses
      19 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      119 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      63 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      41 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      45 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X