Is there a way to print/copy the backtesting result to Excel file?
Author: wbzhang
Creation Date: 10/14/2010 10:17 AM
profile picture

wbzhang

#1
After backtesting, I want to print out the result, especially the performance data and trades data. But now I found the result can only be printed as PDF or to printers. Is there a way to print/copy them to Excel? thanks..
profile picture

Eugene

#2
Right click, copy to clipboard, then paste to Excel.
profile picture

daivd_leake

#3
Hi Eugene, whats the best way to write trades to a file during an optimisation?

That is, for each parameter combination I would like to output all the trades, is that achievable?

Thank you
profile picture

Eugene

#4
Hi David,

You could try to call SaveTrades (part of Community Components) from your strategy, for example. Make sure to have included the current strategy parameter values in the file name to make it unique.
profile picture

daivd_leake

#5
Ok thanks, will check it out
profile picture

daivd_leake

#6
Hi Eugene, is there any way to also write each trade's P&L to a file?

Thanks for your help

David
profile picture

Eugene

#7
Hi David,

Yes, as the Wiki suggests It's possible to introduce custom output formats by modifying the method body and re-compiling the assembly on your own. Or you could lose the Tag property and assign it the closed Position's NetProfitPercent property after the trading loop:

CODE:
Please log in to see this code.
profile picture

daivd_leake

#8
Great stuff - thanks
profile picture

daivd_leake

#9
Hi -

I would like to output the bar-by-bar PL rather than the final trades once closed out (and preferably inclusive of commissions). Where the sum of this bar-by-bar PL column would just equal the net PL for the time period

I've tried with the following code inside the bar loop, however this doesn't equal the PL,

Anything I'm missing here? I also note that 'NetProfitAsOfBar will always be based on 1 share while the Strategy is executing' so presumably I need to multiply by position size?

Any suggestions appreciated

Thanks
David

CODE:
Please log in to see this code.
profile picture

Eugene

#10
David, the thing is that unless it's Raw Profit mode you cannot know the position size during the Strategy execution phase. The position sizing is an overlay (that is beyond your script's control) that kicks in after the Strategy has first executed all theoretical trades in Raw Profit mode with 1 share.

As this discussion has deviated from original poster's question noticeably and repeatedly, kindly consider asking any followup questions you may have in a new thread(s).
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).