Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 warreng86, 11-10-2020, 02:04 PM
      5 responses
      1,356 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by Perr0Grande, Today, 08:16 PM
      0 responses
      3 views
      0 likes
      Last Post Perr0Grande  
      Started by elderan, Today, 08:03 PM
      0 responses
      5 views
      0 likes
      Last Post elderan
      by elderan
       
      Started by algospoke, Today, 06:40 PM
      0 responses
      10 views
      0 likes
      Last Post algospoke  
      Started by maybeimnotrader, Today, 05:46 PM
      0 responses
      12 views
      0 likes
      Last Post maybeimnotrader  
      Working...
      X