Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Max daily loss

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

    Max daily loss

    I want to set a maximum daily loss using a strategy builder but I want it to work even on the strategy analyzer so that I can see the results that give me how can I do it?

    #2
    Hello Adamel,

    Thank you for your post.

    We have posted an example named 'DailyLossLimitBuilderExample_NT8.zip' (on post #1) that shows how to configure a daily loss limit within the Strategy Builder:



    This example will work with the Strategy Analyzer as well.

    Please let us know if we may be of any further assistance.

    Comment


      #3
      the attachment you send is very confusing try just to tell me how the conditions I need to put will look like what ?

      Comment


        #4
        Hello Adamel,


        Have you been able to import the strategy (DailyLossLimitBuilder) and open it?

        After importing this example strategy, you will be able to view it in the NinjaScript Editor and Strategy Builder.

        The Strategy Builder Custom Series can be used with offsets to do math and subtract the total PNL from yesterdays PNL to get the current PNL.

        If you haven't already imported DailyLossLimitBuilder, here is a basic guideline on how to import NinjaScript add-ons in NinjaTrader:
        • Download the NinjaScripts to your desktop, and keep them in the compressed .zip file.
        • From the Control Center window, click Tools > Import > NinjaScript Add-on...
        • Select the downloaded .zip file
        • NinjaTrader will then confirm if the import has been successful.
        To view the NinjaScript Strategy from within the Strategy Builder, go to New > NinjaScript Editor > Double-click on the 'Strategy' folder > Right click on DailyLossLimitBuilderExample and select 'Open'.

        Once the example strategy is open in the Strategy Builder, you'll see how there are two custom series (YesterdaysPNL and StrategyTotallPNL); an input and a variable, and 6 sets of conditions and actions where the PNL calculations are defined.

        Please let me know if I may be of any further assistance.​

        Comment


          #5
          the strategy have 6 setes 1 for long and 1 for shorts I need also to do the 4 other sets like it exactly ? and the print condition is just for print a text I don't need them ?

          Comment


            #6
            Hello Adamel,

            Thank you for your reply.

            You don’t need to use the exact sets shown in the example, but the general logic can be used as a guideline for how to implement a daily loss limit.

            The print and draw actions are optional.

            Here is an explanation of the sets in the example:

            A series is added on the Additional Data page to remember the pnl from the previous session and to do custom math.
            • In set 1, the values in the series are carried forward to the next bar.
            • In set 2, the DailyPNL is reset to 0 for a new day of trading pnl. The previous session PnL is saved to the series.
            • In set 3, the DailyPNL is set to the current total Pnl minus the previous sessions ending PnL
            • In set 4, a print is added to give insight into understanding the behavior, and why the next condition will evaluate as true or false
            • In set 5, are the regular conditions to enter a long trade, including a check that the DailyPnL is greater than the daily loss allowed
            • In set 6, are the regular conditions to enter a short trade, including the same check the DailyPnL is greater than the daily loss
            Remember that you can view each condition and action by pressing the edit button.

            Please let me know if you have any further questions.

            Comment


              #7
              whish sets are optional.?

              Comment


                #8
                Hello Adamel,

                Thank you for your reply.

                Set 4 includes only a print to help determine whether the conditions in sets 5 and 6 will evaluate as true or false.
                This is optional.

                You are also free to customize the entry conditions in sets 5 and 6 if you would like.
                Just make sure to include the part that checks that the DailyPnL is greater than the daily loss allowed

                Please let me know if I may be of any further assistance.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by NullPointStrategies, Today, 05:17 AM
                0 responses
                44 views
                0 likes
                Last Post NullPointStrategies  
                Started by argusthome, 03-08-2026, 10:06 AM
                0 responses
                124 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                65 views
                0 likes
                Last Post NabilKhattabi  
                Started by Deep42, 03-06-2026, 12:28 AM
                0 responses
                42 views
                0 likes
                Last Post Deep42
                by Deep42
                 
                Started by TheRealMorford, 03-05-2026, 06:15 PM
                0 responses
                46 views
                0 likes
                Last Post TheRealMorford  
                Working...
                X