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

SystemPerformance.AllTrades.Count returns 0

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

    SystemPerformance.AllTrades.Count returns 0

    I need LosingTrades.Count, which also returns zero. All SystemPerformance values return nothing.

    This is a multi-instrument backtest. I just spent 4 hours trying to search for a solution.

    Yes, IncludeTradeHistoryInBacktest= true.

    I just need to know if my last trade was a loss from any instrument in the strategy.

    #2
    Hello waynewright33,

    Thank you for your post.

    On the Strategy Analyzer summary, after running the backtest do you see values on the summary?

    I look forward to your response.

    Comment


      #3
      Yes?

      Are you asking me if I'm trying to get Trades count values out of a strategy that doesn't place any trades?

      Comment


        #4
        The only thing I can think of is the trades aren't exited by my strategy per say. They all "exit on close". i.e I just hold the position until the contract expires.

        Any suggestions?

        Comment


          #5
          Not sure if related but I noticed and also reported {1659944} that the trades collection is empty if the strategy is not inside a chart, like for example being added to Control center.
          So I guess same would happen if used on Strategy Analyzer.
          pmaglio
          NinjaTrader Ecosystem Vendor - The Indicator Store

          Comment


            #6
            Yes this would be the case in my scenario as well. All 92 trades take place on instruments added by code, the primary instrument does not trade.

            So how do I fix this?

            Comment


              #7
              Originally posted by NinjaTrader_PatrickH View Post
              Hello waynewright33,

              Thank you for your post.

              On the Strategy Analyzer summary, after running the backtest do you see values on the summary?

              I look forward to your response.
              I am looking forward to your response as well.

              Comment


                #8
                Hello waynewright33,

                Thank you for your response.

                While the strategy is running if no trade has been closed then the count is zero. However, please try using SystemPerformance.LosingTrades.TradesCount and advise if the same behavior is seen.

                I look forward to your response.

                Comment


                  #9
                  Tried that already.

                  All the trades get closed, just not by my strategy directly placing the exit order, they "Exit on close" as the contracts expire over a period of 6 years.

                  Comment


                    #10
                    Hello waynewright33,

                    Thank you for your response.

                    So the trades are closing at the end of the session or the end of the backtest?

                    Is this a strategy we can test on our end? If so, please attach the strategy to your response or send to platformsupport[at]ninjatrader[dot]com with 'ATTN: Patrick H' and a reference to this thread.

                    You can export your strategy by going to Tools > Export > NinjaScript Add On > Add > select your strategy > OK > Export > name the file 'NTsupport' > Save.

                    The file will be located under Documents\NinjaTrader 8\bin\Custom\ExportNinjaScript. Please attach the file to your response.

                    Comment


                      #11
                      No they close throughout the backtest, with one contract closing every month for 6 years.

                      I should also note that the primary instrument is actually an index.

                      Can't attach file via PM so, what's your email and I'll email it to you.
                      Last edited by waynewright33; 02-16-2017, 11:17 AM.

                      Comment


                        #12
                        Thank you, waynewright33,

                        May I also request a screenshot of your settings in the Strategy Analyzer?

                        Comment


                          #13
                          Ya sure, can I get your email and I'll shoot those over right away.

                          Comment


                            #14
                            Hello waynewright33,

                            Thank you for your response.

                            Please send to platformsupport[at]ninjatrader[dot]com with 'ATTN: Patrick H' in the subject line.

                            Comment


                              #15
                              After some testing I have confirmed that the problem is with the trades that "Exit on close" as the contracts expire not being recognized as completed trades by the software.

                              Is there a way to fix this bug?

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by guillembm, Yesterday, 11:25 AM
                              2 responses
                              9 views
                              0 likes
                              Last Post guillembm  
                              Started by junkone, 04-21-2024, 07:17 AM
                              9 responses
                              68 views
                              0 likes
                              Last Post jeronymite  
                              Started by trilliantrader, 04-18-2024, 08:16 AM
                              4 responses
                              18 views
                              0 likes
                              Last Post trilliantrader  
                              Started by mgco4you, Yesterday, 09:46 PM
                              1 response
                              11 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by wzgy0920, Yesterday, 09:53 PM
                              0 responses
                              10 views
                              0 likes
                              Last Post wzgy0920  
                              Working...
                              X