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

Strategy Builder - Max daily loss and max profit stops

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

    Strategy Builder - Max daily loss and max profit stops

    Hi,

    I am using the Strategy Builder to build a strategy and run into some issues while trying to define a max daily loss and max profit. How do I use the builder to create a condition in which it stops trading if I reach a predetermined max daily loss or profit (which I can enter as input so they can be selected each time)?

    Also, is there a way to set a limit on the number of daily trades? Something like a trade count that will prevent the strategy from executing more trades if a predefined limit is reached?

    Thanks
    David

    #2
    Hello David, thanks for writing in.

    We have a reference sample here demonstrating how to hold a strategy once a certain cumulative profit is reached:

    https://ninjatrader.com/support/help...nce_user_d.htm

    The StopStrategy method can not be called from the builder, so you will need to incorporate this condition in your entry order conditions. Something like

    if(condition to trade && SystemPerformance.AllTrades.TradesPerformance.Curr ency.CumProfit < 1000 || SystemPerformance.AllTrades.Tra desPerformance.Currency.CumProfit > -400)
    {
    //perform the trade.
    }

    You would need to unlock the script and write by hand to count the number of trades that happened, that can not be done from the builder.

    Please let me know if I can assist any further.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Chris,

      Thanks!

      If I unlock the script and make changes by hand as suggested above, will I be able to go back and continue with the Builder or will I be on my own at that point?

      Thanks
      David

      Comment


        #4
        Hello David, thanks for your reply.

        The script would not be editable in the builder after unlocking, it must be coded by hand after unlocking.

        Kind regards.
        Chris L.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by funk10101, Today, 09:43 PM
        0 responses
        4 views
        0 likes
        Last Post funk10101  
        Started by pkefal, 04-11-2024, 07:39 AM
        11 responses
        36 views
        0 likes
        Last Post jeronymite  
        Started by bill2023, Yesterday, 08:51 AM
        8 responses
        44 views
        0 likes
        Last Post bill2023  
        Started by yertle, Today, 08:38 AM
        6 responses
        26 views
        0 likes
        Last Post ryjoga
        by ryjoga
         
        Started by algospoke, Yesterday, 06:40 PM
        2 responses
        24 views
        0 likes
        Last Post algospoke  
        Working...
        X