Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Irrelevant results based on 1 trade only

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

    #16
    ch9090,

    No problem.

    Are you attempting to only avoid a profit factor of 99? Do you want profit factors > 99? This is a massive profit factor, but I suppose it would be possible.

    Please let me know if I may assist further.
    Adam P.NinjaTrader Customer Service

    Comment


      #17
      I am really trying to avoid a PF of 99 which usually is associated with 1 or 2 trades only.

      That is why a combination of PF < 99 and # of trades > 10 should produce more relevant optimized parameters for my simple strategy.

      chris

      Comment


        #18
        I've run some optimizations and it still returns a PF of 99 based on a few trades... Any additional ideas?

        Comment


          #19
          ch9090,

          Are you able to add the new optimization type in the Optimization properties > "Optimize on" field?
          Adam P.NinjaTrader Customer Service

          Comment


            #20
            Hi Adam,

            Absolutely and I've used your suggestion for the code i.e.

            if (systemPerformance.AllTrades.TradesPerformance.Pro fitFactor < 99 && systemPerformance.AllTrades.TradesCount < 10)
            return 0;
            else
            return (double) systemPerformance.AllTrades.TradesPerformance.Prof itFactor;

            Comment


              #21
              This might be the problem : systemPerformance.AllTrades.TradesPerformance.Pro fitFactor < 99

              It can still return 99 since if ProfitFactor = 99, then this condition fails, and it can return the profit factor.

              I believe you want to use something like,

              if( ProfitFactor < 99 && NumberTrades>=10 )
              {
              return ProfitFactor;
              }
              else
              {
              return 0;
              }
              Adam P.NinjaTrader Customer Service

              Comment


                #22
                Hi Adam,

                You were right, the logic was flawed!

                I hope I do understand the code correctly now:

                1) the strategy PF factor will be optimized based on two conditions (PF<99 and # trades >=10).
                2) the "else return 0" just means it will force the optimization?

                I am asking this because so far my tests are returning good results (# of trades >= 10 and PF < 99) but I am not sure how to interpret the "return 0" since we're using bolean operators here?

                Cheers, chris

                Comment


                  #23
                  CH9090

                  Essentially, there are still optimization runs that are returning profit factors greater than 99 but you are intercepting them and returning a profit factor of 0 instead of the real profit factor. You are only using the booleans as logical operators to do the interception, however you are still returning the actual calculated profit factor when its less than 99 and there were more than 10 trades.
                  Adam P.NinjaTrader Customer Service

                  Comment


                    #24
                    Dear Adam,

                    Many thanks for the quick reply.

                    I've been running a few dozens (if not hundreds) of optimization runs now and I never saw a PF > 99.

                    If I am not mistaken it is defined as (gross profit/gross loss) and when "gross loss" is 0 it returns a PF of 99 (instead of infinite). In theory you could have a PF > 99, but again I never saw one. Have you?

                    I optimize also on "aggregated results" and even if the optimization returns a few PF=99 for some individuals stocks, the PF of the "combined results" is always well below 99. I guess it means that your custom optimization works fine and I would even say that the results are more reliable compared to optimizing on the PF factor only.

                    Cheers,
                    Chris

                    Comment


                      #25
                      Originally posted by ch9090 View Post
                      Dear Adam,

                      Many thanks for the quick reply.

                      I've been running a few dozens (if not hundreds) of optimization runs now and I never saw a PF > 99.

                      If I am not mistaken it is defined as (gross profit/gross loss) and when "gross loss" is 0 it returns a PF of 99 (instead of infinite). In theory you could have a PF > 99, but again I never saw one. Have you?

                      I optimize also on "aggregated results" and even if the optimization returns a few PF=99 for some individuals stocks, the PF of the "combined results" is always well below 99. I guess it means that your custom optimization works fine and I would even say that the results are more reliable compared to optimizing on the PF factor only.

                      Cheers,
                      Chris
                      Chris,

                      What is probably happening is that NinjaTrader catches a profit factor of NaN, i.e. X / 0 and setting it to 99 or something since 99 is a ridiculously high profit factor. I've never seen any long term running strategy pull off that level let alone more.

                      Anyway, I am glad its working out for you.

                      Please let me know if I may assist further.
                      Adam P.NinjaTrader Customer Service

                      Comment


                        #26
                        Thank you Adam, all clear now until my next post :-)

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by GussJ, 03-04-2020, 03:11 PM
                        11 responses
                        3,229 views
                        0 likes
                        Last Post xiinteractive  
                        Started by andrewtrades, Today, 04:57 PM
                        1 response
                        14 views
                        0 likes
                        Last Post NinjaTrader_Manfred  
                        Started by chbruno, Today, 04:10 PM
                        0 responses
                        7 views
                        0 likes
                        Last Post chbruno
                        by chbruno
                         
                        Started by josh18955, 03-25-2023, 11:16 AM
                        6 responses
                        441 views
                        0 likes
                        Last Post Delerium  
                        Started by FAQtrader, Today, 03:35 PM
                        0 responses
                        12 views
                        0 likes
                        Last Post FAQtrader  
                        Working...
                        X