Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Automatically export backtest trades to CSV

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

    Automatically export backtest trades to CSV

    Hi,

    Is it possible somehow to automatically have backtests to export taken trades into a folder (for further analysis)?

    In Strategy Analyser, select "Trades" in "Display" -dropdown, I can see all the trades taken and manually export them to .csv or .xls. So my question is; can these be automatically exported to a folder (where are these trades saved, in database or local file. Can I access these trades somehow)?

    I'm running analysis on a Instrument list and the analysis I get from Ninjatrader is not enough in this case, need to import the results to a custom designed database for more in depth analysis.

    Thanks!

    br,
    Chris

    #2
    Hello Chris,

    Thanks for writing in to our Support team.

    There would not be a way to set up NinjaTrader to automatically export trades to a specific folder.

    Manually creating the report after the backtest via the Strategy Analyzer window would be my suggested course of action if you want to perform extensive technical analysis on those trades.

    All of your historical trades and backtest results would be saved in the database file, but there wouldn't be a way for us to extract only the trade information from the database to for use in technical analysis.

    You could accomplish this behavior via NinjaScript, however you would have to make use of some other general C# concepts in addition to some specific NinjaScript methods.

    It is possible that there is another software developer who has created software that accomplishes this, however I am not familiar with a particular vendor that offers software that does what you would like.

    In my search on the NinjaTrader Support Forum, I wasn't able to find a strategy that exhibits this behavior.

    We do have a NinjaTrader Ecosystem team that can provide you with a list of professional NinjaScript Consultants you can work with if you would be interested in speaking to a professional about building a custom strategy that does this. If you're interested in this option, please let me know and I'd be happy to reach out to a member of the Ecosystem team to assist you further.

    Please let me know if I may be of any further assistance.
    Alan S.NinjaTrader Customer Service

    Comment


      #3
      Hi,

      Thanks for your reply!

      I saw feature request dating back to 2012 for exporting trades backtested on instrument lists but still not implemented, I guess.

      If you test on the whole SPX underlying instruments, clicking through 500 instruments and manually exporting those trades doesn't seem like an option to figure out, is the strategy "working" or not.

      It seems it also would be possible by adding the instruments to the strategy but I have not found any examples on this:


      br,
      Chris

      EDIT: would it be possible to query the NT SDF -database file? If yes, I could get what I want from there since I'll be piping the trade data to MySQL after all for further strategy analysis.
      Last edited by suroot; 10-11-2017, 02:07 PM.

      Comment


        #4
        Hello suroot,

        Thanks for your reply.

        When backtesting, you do have the option to apply the strategy to an instrument list instead of running 500 individual backtests.

        To do this, click on the Instrument drop down menu in the Strategy Analyzer --> Select one of your instrument lists, then the first option you will have after hovering your mouse over your selected list would be to Select All. In this way you can run one backtest and receive results for numerous instruments.

        It certainly would be possible to communicate with the database file directly rather than through NinjaScript, however using this method to retrieve historical trade results or backtest results would be unsupported. If you want to continue pursuing this option, I will not be able to assist you in the same way that I could if you were asking about NinjaScript items.

        We do have a NinjaTrader Ecosystem team that can provide you with a list of professional NinjaScript Consultants that you can discuss this item with. Our NinjaScript Consultants would be eager to create or modify this script at your request or assist you with developing this script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Unfortunately, in the support department at NinjaTrader it is against our policy to create, debug, or modify code or logic for our clients. This is so that we can maintain a high level of service for all of our clients as well as our partners. If you want me to provide you with this information, please let me know.

        Please let me know if I may be of any further assistance.
        Alan S.NinjaTrader Customer Service

        Comment


          #5
          Hi,

          Thanks for your reply!

          When backtesting, you do have the option to apply the strategy to an instrument list instead of running 500 individual backtests.
          This I know about and use all the time. It is getting the data out from the backtest that is my issue; it is not time effective going through all instruments and manually "click export". For only one backtest run on SPX500 underlying, it would likely take 2-5 days to manually click through them all. This is not an option.

          The whole idea about backtesting, is getting data to analyse, right?

          What about this option then disucussed in the other thread, that is possible to script?

          You can export the data of all instruments traded (if they are added into the strategy through programming in NinjaScript)
          br,
          Chris

          Comment


            #6
            Hello suroot,

            Thanks for your reply.

            I found a helpful link in the forum thread that you referenced:
            http://www.ninjatrader.com/support/f...402#post212402

            In this post, the user created an indicator which exports historical data to an excel file that you can use as a reference to begin this project.

            To access the trade information, you will have to pull that information from a TradeCollection. You can find more information about TradeCollections here:
            https://ninjatrader.com/support/help...collection.htm

            You can find more information on Trade objects here:
            https://ninjatrader.com/support/help...n-us/trade.htm

            Here is a helpful sample posted in the Reference samples section of our forum that accesses Trade objects from aTradeCollection:
            https://ninjatrader.com/support/foru...ad.php?t=19289

            Please let me know if I may be of any further assistance.
            Alan S.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by ZenCortexCLICK, Today, 04:58 AM
            0 responses
            2 views
            0 likes
            Last Post ZenCortexCLICK  
            Started by sidlercom80, 10-28-2023, 08:49 AM
            172 responses
            2,280 views
            0 likes
            Last Post sidlercom80  
            Started by Irukandji, Yesterday, 02:53 AM
            2 responses
            17 views
            0 likes
            Last Post Irukandji  
            Started by adeelshahzad, Today, 03:54 AM
            0 responses
            4 views
            0 likes
            Last Post adeelshahzad  
            Started by Barry Milan, Yesterday, 10:35 PM
            3 responses
            13 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Working...
            X