Dump "price data" and "equity curve" to CSV file from Strategy
Author: ThomasLykholtDahl
Creation Date: 10/9/2017 11:18 AM
profile picture

ThomasLykholtDahl

#1
I have a collection of Strategies, which I need to run on a large list of instruments. For each instrument and each strategy, I need to export data to a csv file. The data should appear (approximately) as if I ran each strategy on each instrument, and for each run i would

1. Select the "Chart pane" and right-click/select "copy price data to clipboard"
2. Copy data to an excel sheet
3. Select the "Equity Curve" pane in WealthLab, and right-click/select "copy equity curve data to clipboard"
4. Paste the data next to the "price data" in the excel sheet
5. save the excel sheet as a csv

I am looking for a way to automate this process... Is something like this possible though a WealthLab strategy, that calls a list of strategies, using different data as input, and then dumps the data view mentioned...?

Best regards

profile picture

Eugene

#2
Hi,

Before anything else I wonder what task are you trying to solve by going the CSV way? Sometimes it's a good idea to lay out your objective as there may be a more straightforward way.

QUOTE:
1. Select the "Chart pane" and right-click/select "copy price data to clipboard"

Price data can be easily exported from a Strategy. See this Wiki knowledge base article: Exporting to ASCII comma-separated files (CSV)

QUOTE:
3. Select the "Equity Curve" pane in WealthLab, and right-click/select "copy equity curve data to clipboard"

Exporting the equity curve is way more tricky. Let's start that you cannot do it out of the box since accessing the portfolio equity is unsupported in Wealth-Lab. Fortunately for you, there's a facility to approximate the equity curve calculation to a good extent: Interacting Dynamically with Portfolio Level Equity. All you have to do is export the globalEquity DataSeries to CSV file as explained by the first link.

QUOTE:
that calls a list of strategies

While certainly possible, this is by far the most tricky part of your request. Designing a batch export would require you to use System.Reflection and some undocumented (read: unsupported) Wealth-Lab classes etc. Sorry, no example can be provided at this time.
profile picture

Cone

#3
The Equity curve and other visualizers execute in "post-processing"; in other words, after the strategy has run. But before trying to provide a solution for you, are you interested in just the raw profit results for each instrument or something else?

For example, if you ran your strategy in Raw Profit mode, allocating say, $10,000 to each trade, it would be easy to create a raw profit "equity" curve and export it with the price data from a Strategy.
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).