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
    BertrandNinjaTrader Customer Service

    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.
        BertrandNinjaTrader Customer Service

        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.
              BertrandNinjaTrader Customer Service

              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...
                    BertrandNinjaTrader Customer Service

                    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.
                        BertrandNinjaTrader Customer Service

                        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 quantismo, 04-17-2024, 05:13 PM
                          3 responses
                          25 views
                          0 likes
                          Last Post NinjaTrader_Gaby  
                          Started by ScottWalsh, 04-16-2024, 04:29 PM
                          7 responses
                          34 views
                          0 likes
                          Last Post NinjaTrader_Gaby  
                          Started by cls71, Today, 04:45 AM
                          0 responses
                          5 views
                          0 likes
                          Last Post cls71
                          by cls71
                           
                          Started by mjairg, 07-20-2023, 11:57 PM
                          3 responses
                          214 views
                          1 like
                          Last Post PaulMohn  
                          Started by TheWhiteDragon, 01-21-2019, 12:44 PM
                          4 responses
                          547 views
                          0 likes
                          Last Post PaulMohn  
                          Working...
                          X