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

Ending Ninjascript strategy

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

    Ending Ninjascript strategy

    How can I check in a Ninjascript strategy, to see if a certain profit level has been reached, and then have the strategy stop?

    #2
    We have seriously enhanced the area of accessing performance data in a strategy with our upcoming NT 6.5. What you want to do can be accomodated in this release. We expect beta next week sometime.
    RayNinjaTrader Customer Service

    Comment


      #3
      Ending Ninjascript strategy

      Thanks Ray,
      Can I test Beta version, and be notifyed when available?
      Jim

      Comment


        #4
        Yes, we will provide public access to the beta software when available.
        RayNinjaTrader Customer Service

        Comment


          #5
          ending ninjascript

          is this beta version on target to be released this week?

          Comment


            #6
            Yes, that is what we are shooting for.
            RayNinjaTrader Customer Service

            Comment


              #7
              This will be a serious enhancement. Can you tell us how to access it? Let's say we want to measure the current P/L in ticks, the max adverse excursion in ticks and the max favorable excursion in ticks and set each equal to a user variable. What would be the code to call the P/L this bar, MAE and the MFE?

              Thanks,

              dendy.

              Comment


                #8
                When the beta is out, it will come with documentation that will answer your questions.
                RayNinjaTrader Customer Service

                Comment


                  #9
                  Thanks Ray,

                  Will the Beta version be announced just like one of the regular versions (on program start-up)? Or will it be announced only on the website somewhere.

                  Thanks,

                  dendy.

                  Comment


                    #10
                    It will be announced in the 6.5 Beta section of this forum to start.
                    RayNinjaTrader Customer Service

                    Comment


                      #11
                      I see.

                      Thanks,

                      dendy.

                      Comment


                        #12
                        ending ninjascript

                        I have 6.5 installed and am back to my original question:

                        How can I check in a Ninjascript strategy, to see if a certain profit level has been reached, and then have the strategy stop?

                        Comment


                          #13
                          Please see the Help Guide section Strategy Performance Methods. We will post reference samples in this area in the coming weeks.
                          RayNinjaTrader Customer Service

                          Comment


                            #14
                            ending ninjascript

                            Will this coding do what I want?
                            Stop the strategy from running once I have achieved a net realized profit of at leat $100?


                            // If the profit on real-time trades is > $100 stop trading
                            if (Performance.RealtimeTrades.TradesPerformance.Curr ency.CumProfit > 100)
                            return;

                            Comment


                              #15
                              To be technically accurate:

                              - If you include that code in any public event driven method (such as OnBarUpdate()) it will return from that method. Thus, if its the first line in that method, it will no longer process your code underneath that condition check.

                              - So if you only have strategy order logic in OnBarUpdate(), you could add that line of code and prevent any further processing of this method. It will not stop your strategy from running but it will do what you want.

                              - If you want to terminate the strategy (remove it from a chart its running etc..) you can set the strategy "Running" property to "false".

                              // If the profit on real-time trades is > $100 stop trading
                              if (Performance.RealtimeTrades.TradesPerformance.Curr ency.CumProfit > 100
                              )
                              Running = false
                              ;
                              RayNinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Radano, 06-10-2021, 01:40 AM
                              19 responses
                              604 views
                              0 likes
                              Last Post Radano
                              by Radano
                               
                              Started by KenneGaray, Today, 03:48 AM
                              0 responses
                              3 views
                              0 likes
                              Last Post KenneGaray  
                              Started by thanajo, 05-04-2021, 02:11 AM
                              4 responses
                              470 views
                              0 likes
                              Last Post tradingnasdaqprueba  
                              Started by aa731, Today, 02:54 AM
                              0 responses
                              5 views
                              0 likes
                              Last Post aa731
                              by aa731
                               
                              Started by Christopher_R, Today, 12:29 AM
                              0 responses
                              10 views
                              0 likes
                              Last Post Christopher_R  
                              Working...
                              X