Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to LIMIT loss and daily gain?

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

    #16
    Hello Joe P,

    Welcome to the NinjaTrader forums!

    The scripts sounds like its on the same topic and is fine to discuss on the forums.
    Our support will not have feed back on 3rd party apps, however the community may have experience they would like to share.

    Let me know if our support staff may assist with any questions you have about the Strategy Builder.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #17
      Hello,
      Thank you for all the good information on this BLOG. It has been very helpful.

      I wish, like many of you, to minimize my daily losses. I have followed this thread and tried implementing the suggestion Paul H posted. I run a strategy with this code inserted and another strategy like it without the code as a control. Some where I have gone wrong because the control strategy places a trade, the daily lose strategy does not.

      Will someone please look at the screen shots of the portion of the my strategy that deals with limits and tell me where I have gone wrong. (1 of 2 photo posts)

      Thank you! Joe P

      Comment


        #18
        (2 of2) photos posts:

        Comment


          #19
          Hello Joe,

          Did the condition to place the order evaluate as true?

          You can print the time of the bar in the actions to see on which bars the condition is evaluating as true.

          Below is a link to a forum post that demonstrates how to use prints to understand behavior and includes a video created with the Strategy Builder.
          https://ninjatrader.com/support/foru...121#post791121


          If the condition is not evaluating as true, it will be necessary to add a new condition set with no conditions and print the time of the bar and all values used in the condition that places the order.

          I am happy to assist with analyzing the output from the output window.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #20
            Hello Chelsea B.
            Thank you for your reply.
            I will take a look at the video link you provided so I can answer your question "
            Did the condition to place the order evaluate as true?"
            In the mean time, based of ther 5 photos above, did I set up the strategy builder correctly, based on Paul H's description.

            Joe P.

            Comment


              #21
              Hello Joe,

              It would be hard to say for sure.

              With the If Any set in the condition group, the cumulative profit can be greater than or equal to 400, or can be less than or equal to -250, or the OkToTrade bool can be true (without the conditions having to be true).

              This would be when the cross is occurring (due to the If All on the main conditions).

              I don't see where OkToTrade is being set to true so there is not enough information to say what would happen.

              Typically I use prints to see if the condition is written correctly.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #22
                Hello,
                Has anyone made this work with Strategy Builder?

                "
                You would create the bool variable in the "Variables" section of the Inputs and variables screen. As a suggestion, you might use the name of "OkToTrade" and set it true by default. The name can be anything you wish but using OkToTrade makes the function of the bool clear when looking at the strategy builder.

                In a set, in the Conditions section, you would create a group to place two conditions. Please left click on the word "group" to open the "Condition Group Editor" window. It is important that the selection "if Any" is showing in the group drop down, as you will want either condition to set the bool to false. Now add the two PNL conditions. Click Add to open the conditions screen. On the left side select the strategy folder and inside locate and select "RealizedPnL", in the center select "Greater equal", on the right side select the "Misc" folder and inside find and select "Numeric value", in the field enter the value 400, click OK to add the condition. Repeat the same steps to add the next condition except in the center select "Less equal" and on the right, for the numeric value, enter -200, click OK. The Conditions group editor window should have both conditions and again should show "if Any". Click OK to complete the conditions section.
                Next in the actions section (below the conditions section), please left click "add" to add an action.In the "Actions" window, left click on to open the "Misc" folder, locate and select Set OkToTrade (if that was the name you used, or select whichever name you gave to your bool variable), once select the bottom 1/2 of the window will show the bool and a check box. It will show checked because it was set to true by default when created, at this point we want it to be set to false, so please click to "uncheck" the check box which means we are now setting it false. Click OK to close the actions window.

                So you have created a set that will set the bool OkToTrade to false if the realizedPnL is >=400 or is <= -200

                In your condition sets where you have your entry conditions, you can now add the condition to see if the bool OkToTrade is true. Please open one of your existing condition sets where you place a trade. In the conditions section click "add", in the conditions window, on the left side, left click on the folder "user variables", in there select "OkToTrade". In the center section select "Equals", on the right side select the "misc" folder and find and select "True", then click OK to add the condition. Repeat this for ever set where you have an entry condition."

                Thanks

                Comment


                  #23
                  [QUOTE=jpatri;n1108140]Hello,
                  Has anyone made this work with Strategy Builder?

                  YES, not "this", but something similar. I myself usually code bots with NinjaScript, but I had a look, since this topic is raised again and again, e.g. here
                  Hi Everyone, I'm looking for a NT8 Add on, Strategy, or anything that can limit daily profit and/or stop loss for my strategies. It would also have to reset for the following day automatically after a limit was reached. I know this can be coded into an existing strategy, but I'm looking for more of a universal option that I

                  In the above thread, it was suggested to restart the strategy every day to enable Daily Loss/Profit Limit Control when using StrategyBuilder.
                  Well, the question is: Is this really needed? The attached is pure StrategyBuilder.
                  Watch how trading stops, after the daily limit was touched or crossed.
                  Limit of 500 per day, looking at PnL of closed trades only. Once, the limit is touched/crossed, trading stops, and CumNetPnL is the base for the next day.
                  Trade 8 finishes the first day with -500 (touched). On day two, 0 or -1000 is the upper/lower limit, crossed with closing of trade 28 (-1025), next day new game with -525 or -1525 upper/lower limit, again trading stopped in line with the rules after trade 34 or -525 (touched), then trade 48 with -1025 (touched), then trade 72 with -515,20 (crossed).
                  As said, "poor" StrategyBuilder.
                  "What else?"
                  NT-Roland
                  Attached Files

                  Comment


                    #24
                    Does your script add the Realized PnL to the Unrealized PnL while a trade is occuring to determine whether to close a trade or not or is it just looking at the Realized PnL?

                    Originally posted by algotrading View Post
                    Here's some NT8 code that will limit daily PL and doesn't need to be reset each session. Link

                    Comment


                      #25
                      Hello saxcollector,

                      Welcome to the NinjaTrader forums!

                      Below is a link to examples of daily loss limits.
                      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

                      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
                      11 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