• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Daily loss limit examples

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

    Daily loss limit examples

    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

    DailyLossLimitMultiTradeExample_NT7 - http://ninjatrader.com/support/forum...367#post475367

    Update Sep 4th, 2018:
    "I realized the print in OnPositionUpdate should print when currentPnL is equal to less than the LossLimit, not just less than it."
    Attached Files
    Last edited by NinjaTrader_ChelseaB; 09-04-2018, 08:10 AM.
    Chelsea B.NinjaTrader Customer Service

    #2
    excellent...thank you

    Comment


      #3
      Here's some more NT8 code that does this. Link

      Comment


        #4
        Hello Chelsea,
        Could you please help me. I would like to have an add-on that will stop all my positions if I reach 300$ loss?
        How do I need to adjust this strategy so NT8 stops me out if I reach 300$ daily loss?
        Let's say, I trade in the morning and at some point I reach 300$, so NT 8 will exit automatically from all my positions...
        Thank you!

        Comment


          #5
          Hello peter_brv,

          To confirm you are making an Addon and not a NinjaScript Strategy, is this correct? All links below are publicly available.

          You are wanting to loop through all positions on all accounts?

          You would need to loop through the Account.All and for each account loop through the orders and custom calculate the PnL.
          https://ninjatrader.com/support/help.../en-us/all.htm
          https://ninjatrader.com/support/help...rs_account.htm

          You might be able to make a custom TradeCollection and fill it with orders, but this would be outside of what is supported by NinjaTrader Support.
          https://ninjatrader.com/support/foru...407#post844407

          Then after collecting the PnL, you would need custom logic to loop through all positions and close the positions or call Flatten() on the account.
          https://ninjatrader.com/support/help...us/flatten.htm
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Thank you. Bad thing - I am not a programmer, so it'll be a challenge. I guess I 'll have to search for an engineer for this.
            The reason I wanted that add-on is to "discipline myself" and cancel trading for a day of 200$ loss....

            Comment


              #7
              Rookie question here. How do I view the DailyLossLimitExample_NT8.zip (1.6 KB, 1 view) once I import it?

              Comment


                #8
                For some reason, I had to import the script 3 or 4 times before it was visible in the NinjaScript Editor.

                Now the question is how do I use this in conjunction with the SampleMACrossOver strategy?

                Comment


                  #9
                  Hello JonTansey ,

                  Once the script is imported and a 'Ninajscript imported successfully' message appears, the script can be opened in the New > NInjaScript Editor > explorer pane on the right > Strategies section.

                  You would learn from what the script is doing, see how to collect performance and use this to exit trades and / or prevent new trades, and model the logic in your script similarly. This involves creating variables and using those in the conditions that place orders.
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    Thanks Chelsea. Wish Ninja Trader would code this as an Indicator too that can be used in a Strategy. And also have another Indicator that would limit the number of total trades in a day too.
                    Thanks.

                    Comment


                      #11
                      Hello Trader17,

                      I have submitted your request for the NinjaTrader Development to consider creating a loss limit tool for NinjaScript Strategies.

                      Once I have a tracking ID for this request I will post in this thread for future reference.
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #12
                        Hello Trader17,

                        I have received tracking ID# SFT-2936 for this request for a daily loss limit built into NinjaScript Strategies.

                        Please note it is up to the NinjaTrader Development to decide if or when any request will be implemented.

                        We appreciate your feedback on this.
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #13
                          Thank you Chelsea. Does the example provided work intra bar also or just on a bar close?
                          Thank you.

                          Comment


                            #14
                            Trader17,

                            Chelseas sample is set up to calculate on bar close but could be modified to work intrabar as well
                            Josh G.NinjaTrader Customer Service

                            Comment


                              #15
                              Thank you. Could you ask Chelsea to try to make a similar example please which works intra bar also?
                              Thank you.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by ren37, Yesterday, 09:42 AM
                              5 responses
                              16 views
                              0 likes
                              Last Post koganam
                              by koganam
                               
                              Started by rtwave, 10-22-2019, 12:56 AM
                              8 responses
                              100 views
                              0 likes
                              Last Post koganam
                              by koganam
                               
                              Started by rtwave, Today, 12:46 PM
                              2 responses
                              13 views
                              0 likes
                              Last Post NinjaTrader_ChristopherD  
                              Started by pmallya.nt, Today, 12:55 PM
                              1 response
                              17 views
                              0 likes
                              Last Post NinjaTrader_Kate  
                              Started by GARZONJ, Today, 01:55 PM
                              1 response
                              3 views
                              0 likes
                              Last Post NinjaTrader_PaulH  
                              Working...
                              X