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 bmartz, 03-12-2024, 06:12 AM
        4 responses
        31 views
        0 likes
        Last Post bmartz
        by bmartz
         
        Started by Aviram Y, Today, 05:29 AM
        4 responses
        12 views
        0 likes
        Last Post Aviram Y  
        Started by algospoke, 04-17-2024, 06:40 PM
        3 responses
        28 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by gentlebenthebear, Today, 01:30 AM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by cls71, Today, 04:45 AM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X