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

Exit Strategy after realized pnl is achieved

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

    Exit Strategy after realized pnl is achieved

    Hi,I would like to close or stop my strategy when I achieved a 500 dollars profit daily....is there a way to program it in the strategy builder (nt8)?
    Thanks

    #2
    Hello Italianforex,

    The Strategy Builder does have the Strategy > Realized PnL available, however this is not reset daily. This contains the Realized PnL for all orders ever placed by that instance of the strategy.

    You could write in the entry conditions the Realized PnL must be below 500, and then each day remove and re-add the instance of the script.


    If you wanted to reset on a new session, the PnL would need to be tracked each day and accumulated to a variable that is reset on the new session (or at the time coded in the script).
    This would require the script to be unlocked.
    Below is a link to an example.
    Hello, I've updated the DailyLossLimit and DailyLosLimitMultiTrade examples that were posted on the forum for NinjaTrader 7 for NinjaTrader 8. These are often requested and I felt they are good examples to have for NT8. DailyLossLimitExample_NT7 - http://ninjatrader.com/support/forum...241#post451241 (http://ninjatrader
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChelseaB View Post
      Hello Italianforex,

      The Strategy Builder does have the Strategy > Realized PnL available, however this is not reset daily. This contains the Realized PnL for all orders ever placed by that instance of the strategy.

      You could write in the entry conditions the Realized PnL must be below 500, and then each day remove and re-add the instance of the script.

      Does it work in the backtesting?

      Thanks

      Comment


        #4
        Hello Italianforex,

        Yes, the Strategy Realized PnL is available when backtesting.

        However, this does not reset on a new session. So you would need to backtest one day at a time or unlock the script and add logic to reset this on a new session.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by kujista, Today, 05:44 AM
        0 responses
        6 views
        0 likes
        Last Post kujista
        by kujista
         
        Started by ZenCortexCLICK, Today, 04:58 AM
        0 responses
        9 views
        0 likes
        Last Post ZenCortexCLICK  
        Started by sidlercom80, 10-28-2023, 08:49 AM
        172 responses
        2,281 views
        0 likes
        Last Post sidlercom80  
        Started by Irukandji, Yesterday, 02:53 AM
        2 responses
        18 views
        0 likes
        Last Post Irukandji  
        Started by adeelshahzad, Today, 03:54 AM
        0 responses
        11 views
        0 likes
        Last Post adeelshahzad  
        Working...
        X