Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exporting backtest multiple instrument positions updates

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

    Exporting backtest multiple instrument positions updates

    Hello,

    I'm running the Strategy Analyzer to backtest an Instrument List of around 400 stocks. I need to be able to export each and every trade of this backtest to Excel. I know how to program in C# and I was thinking to export it to CSV files. Is there a way to export one line with the total trade summary like?

    Instrument, Open Time, Close Time, Open Price, Close Price, Qty, Strategy Name, Entry Name, Exit Name (Stoploss or Profit Target), MAE, MFE etc?

    Can I use some kind of OnPositionUpdate method for this?

    Thanks!

    #2
    Hello siroki,

    Thank you for your post.

    SystemPerformance holds all trades and trade performance data generated by a strategy. You may check the last trade from SystemPerformance in OnPositionUpdate. StreamWriter could then be used to write the text to a file. Please refer to the attached sample strategy to see how this may be done.

    Here are some Help Guide links with more information.

    SystemPerformance - https://ninjatrader.com/support/help...erformance.htm

    OnPositionUpdate - https://ninjatrader.com/support/help...tionupdate.htm

    StreamWriter - https://ninjatrader.com/support/help...o_write_to.htm

    Please let us know if we may further assist.
    Attached Files
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      Thank you for your reply. Good to know that SystemPerformance is my way to go. I'm not quite sure how to use it though. I'm seeing very limited documentation. If you can provide me a sample how to (for example) retrieve realized P&L for that trade, that's be very helpful.

      Kind regards,

      Comment


        #4
        Never mind. I already understand that TradeCollection is a collection and should be accessed using [] .. For example SystemPerformance.AllTrades[0].MaeCurrency.

        Thanks! This is perfect!

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        105 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        146 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        71 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        125 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        79 views
        0 likes
        Last Post PaulMohn  
        Working...
        X