Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Limit to stop the strategy

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

    Limit to stop the strategy

    Hi guys again,

    Could anyone tell me ( I've searched a lot but seem I can't find it ) how I can make one strategy to stop whenever it goes up to 300$ limit of winning profit?


    See that as an alternative trial method of strategies. I wanted to know if that can stop
    whenever it reaches 300$ for example on profits.

    #2
    xasou, please take a look at this reference sample here - http://www.ninjatrader-support2.com/...ead.php?t=4084

    All available reference samples can be accessed from this link - http://www.ninjatrader-support2.com/...splay.php?f=30

    Comment


      #3
      Im gonna give it a try! Thanks a lot, I'll let you know what I've found!

      I can put any part of that code included in the sample, in one of my custom strategies to try it out eh??

      Comment


        #4
        You're welcome - yes review the sample and the adapt your code as needed.

        Comment


          #5
          Hm, ok...
          I am looking for the option: "Locking in realized profits after a certain amount of gains have been achieved during the trading session" right?

          Sorry for the numerous questions but I am trying to do that correctly. I won't ask things twice don't worry I'm a fast learner and love trying new things

          Comment


            #6
            Code:
            if (Performance.AllTrades.TradesPerformance.Currency.CumProfit - priorTradesCumProfit >= 300
                            || Performance.AllTrades.TradesPerformance.Currency.CumProfit - priorTradesCumProfit <= -400
                            || Performance.AllTrades.Count - priorTradesCount > 10)
                        {
                            
                           return;
                        }
            Will that work for me? Does it stop now when the Profit reaches 300$?



            Sorry for double posting
            Last edited by xasou; 07-17-2009, 05:21 AM. Reason: double post explanation

            Comment


              #7
              Yes, this is what this sample shows you, you would just have to tweak two things -

              a) profit and loss thresholds where to stop trading
              b) choose to include AllTrades or just the RealttimeTrades as noted in the commentary
              c) number of trades after which to call it a day for the strategy, set to 10 in the sample

              == yes your code below should do it, just give a try....
              Last edited by NinjaTrader_Bertrand; 07-17-2009, 05:32 AM.

              Comment


                #8
                Hehe, Did it! Worked for me


                Thanks a lot for the assistance & patience my friend!!

                Comment


                  #9
                  I was wondering, how is it possible to convert the USD to another currency? Euros or anything else for example?

                  Comment


                    #10
                    The currency used would the the USD, you can convert of course your own limit into the equivalent USD value...

                    Comment


                      #11
                      So I can't input to the code the way to make the strategy stop at 300 Euros or another currency eh?

                      Comment


                        #12
                        Unfortunately not xasou.

                        Comment


                          #13
                          Ok, I thought about it a little better and I understand now. Thanks a lot again

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                          0 responses
                          648 views
                          0 likes
                          Last Post Geovanny Suaza  
                          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                          0 responses
                          369 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by Mindset, 02-09-2026, 11:44 AM
                          0 responses
                          108 views
                          0 likes
                          Last Post Mindset
                          by Mindset
                           
                          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                          0 responses
                          572 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by RFrosty, 01-28-2026, 06:49 PM
                          0 responses
                          574 views
                          1 like
                          Last Post RFrosty
                          by RFrosty
                           
                          Working...
                          X