Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Profit target reached, how to stop strategy?

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

    Profit target reached, how to stop strategy?

    I am running a simple automated system on the eminis with a single indicator, built with the Strategy Wizard. My question concerns profit targets. My goal is for the system to reach a given profit target and then to stop trading for the day once it has been reached even if the original entry condition is still true on the following bars. My problem is that I can't get it to stop entering trades even after the target is reached. I have tried to correct this using "realized PnL" (i.e. don't enter if the PnL for the day has hit $700) but it doesn't backtest properly with the Strategy Optimizer. Is there any other way to accomplish this or am I using "realized PnL" incorrectly?

    #2
    I can't think of an approach in the wizard that could be done easily. Of course this can be done programattically.

    Here is a reference sample for this - http://www.ninjatrader-support.com/v...ead.php?t=4084
    RayNinjaTrader Customer Service

    Comment


      #3
      Thanks, I've output the code from the Strategy Wizard and added your suggested lines. However, when I go to compile, I'm getting CSO103 errors for "priorTradesCumProfit" and "priorTradesCount":

      "The name "priorTradesCount" does not exist in the current context."

      Any suggestions (admittedly I don't know much about this area, my first foray out of the safety of the Wizard)? Thanks very much.

      Comment


        #4
        Likely means the variable is not declared or something like that.
        RayNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CaptainJack, 05-29-2026, 05:09 AM
        0 responses
        286 views
        0 likes
        Last Post CaptainJack  
        Started by CaptainJack, 05-29-2026, 12:02 AM
        0 responses
        178 views
        0 likes
        Last Post CaptainJack  
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        175 views
        1 like
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        263 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        216 views
        0 likes
        Last Post CarlTrading  
        Working...
        X