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 NullPointStrategies, Today, 05:17 AM
        0 responses
        50 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        127 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        69 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        42 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        46 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X