Page 1 of 1

"Raw" results data export from TBB / automated dai

Posted: Wed Jun 22, 2011 1:14 pm
by dantes
Hello everybody -

I'm enjoying the TBB free trial and have a couple questions I could not find answers to:

1. How can I export the performance results in a .txt file?

2. How can I export .txt data of what is visualized as chart-only in the performance results?
(i.e. Monte Carlo CAGR %, Monte Carlo Equity Curve, Monthly Returns, R-Multiple Distribution and so on)
The data is somewhere in TBB as it is visualized in chart format, and I need to access the numbers to do further analysis.

3. What solution do you recommend to automate batch data download and order generation?
Idea is to get an automated email at the end of each day while traveling.

Thanks for your help, I look forward to contributing to the forum.

Posted: Wed Jun 22, 2011 1:49 pm
by sluggo
I prefer to save performance results as Acrobat .pdf files. To do this I navigate to the TradingBlox\Results folder and then open the Blox results file (file extension .htm) with Internet Explorer. Then in IE, File/Print to the Adobe PDF "printer", done. Protip: select Landscape orientation, it makes the charts easier to read.

To save as a .txt file instead, open the Blox results file with IE and select File / SaveAs / Text File. You could also save as a "Web Archive, single file" (file extension .mht)

Dunno about the other stuff

Posted: Wed Jun 22, 2011 5:14 pm
by dantes
Thank you Sluggo.

I'll try to be clearer with an example.

I would like to store the simulation results data for in a format that allows further numerical analysis in Excel/R/MATLAB/you-name-it.

Let's say for example that I build and backtest ten variations of the same system, stepping parameter "x" 10 times.
Now I want to analyze how the distribution of winning months (for example) is affected by the parameter stepping, building a simple table to compare the two:

Parameter "x" ----- % of months with >5% gain
1 ---------------------------- 43%
2 ---------------------------- 38%
3 ---------------------------- 36%
... ---------------------------- ...

I could achieve this if I had access to the "raw data" behind the "Monthly Return Distribution" chart with the distribution in 2% buckets.

Is there a way to export a file like:

Month ----- Return
Jan 11 ----- 2.43%
Feb 11 ---- -0.78%
... ---------- ...

The same question applies to all the results available in "chart-only" format.

The data is obviously produced by TBB itself, so I guess the basic question is:

"How can I access the data behind the charts?"

Thank you!

Posted: Thu Jun 23, 2011 10:01 am
by sluggo
I think your best bet might be to look at the Blox Builder's Guide section 9.5, to find out which computed statistics are available to you. If you want one that isn't presupplied you can always calculate it yourself in the AfterTest script, since Blox does provide the bar-by-bar equity values and the trade-by-trade data. You can write out the data you feel is important (presupplied stats, your own calculations, or both) to a file, in whatever format you like, using the FileManager tools discussed in section 9.7.

I'm sure you've noticed that Preferences offers you the option to create a daily equity log and/or a monthly equity log (these are written to the TradingBlox\Results folder). These logs contain several calculated statistics, one of which is Gain%, so they might contain most or all of what you want. If not, time to start writing code. Or time to instruct your programmer employees to start writing code.

Posted: Thu Jun 23, 2011 12:07 pm
by dantes
Thanks Sluggo - very helpful.

Another thing I like about TB is the very knowledgeable and responsive user base... :D

Posted: Fri Jun 24, 2011 12:31 pm
by babelproofreader
I think that many of the statistical tests you might want to perform would be included in the PerformanceAnalytics R package. If so, I am sure that it would be trivially easy to extract the necessary returns from TB for input to said package.

Posted: Fri Jun 24, 2011 1:26 pm
by sluggo
In the Blox Customers section of this site, there's a post containing the text and figure below. (link1)
For example, here's a single server (2 CPU chips, each chip has 4 cores, each core has 2-way hyperthreading) running 14 parallel copies of Blox. In about half a day, 13 hours, it has completed around 100,000 tests in a parameter-perturbation study
You can see in the figure that each Blox process has been running about 13 hours and 15 minutes.

I suspect the job would slow down significantly if each of those 100,0000 trading system simulations had to write a file of returns out to disk, and pass this file over to R for subsequent analysis. Doing the statistical calculations within Blox (such as in the AfterTest script), using the simulated equity data already in RAM, and merely writing out the computed statistical results, one line of ascii per simulation test, is probably a LOT faster.

Calculating the perfstats externally is fine for small numbers of simulations, but becomes unwieldy for big jobs that run many Blox simulations. Here's another example of a big job: (link2)

Math-for-fun: calculate the average run-time for ONE of those 100,000 trading system simulations. If 14 parallel copies of Blox can compute 100k simulations in 13hrs 15mins of wallclock time, how long for 1 copy of Blox to compute 1 simulation (on average)?

Posted: Fri Jun 24, 2011 4:56 pm
by mojojojo
sluggo wrote:Math-for-fun: calculate the average run-time for ONE of those 100,000 trading system simulations. If 14 parallel copies of Blox can compute 100k simulations in 13hrs 15mins of wallclock time, how long for 1 copy of Blox to compute 1 simulation (on average)?
It's been a long day but I will give it a shot ...

100,000 sims / 14 cores = ~ 7142.86 sim per core
13.25 hrs / 7142.86 SpC = 0.001855 hrs per sim per core = 0.1113 min per sim per core = 6.68 sec per sim per core