Export Information from Alerts Tab
Author: Supersol
Creation Date: 8/5/2016 8:38 AM
profile picture

Supersol

#1
Dear all

how is it possible to export the manual backtest results into something like a csv, xls etc? What I would like to acchive is, that I press the "backtest on symbols" button in portfolio mode with a given percentage of Equity and that I can see the information from the alert tab in an excel (but not more) - so just the trades that have been taken before and just the limits from these trades not more.

In principle it worked to write into a csv but the results are not the same as I can see in the "Alert" Tab - they look like some kind of "raw mode" not portfolio...

Kind regards
Supersol
profile picture

Eugene

#2
Mathias,

You could export a strategy's Alerts with their properties to CSV as exemplified in the QuickRef's "Alert Object" chapter.

Why'd you need to export historical trades to Excel?
profile picture

Supersol

#3
I would like to automatically recheck my Wealth Lab trades with the trades I have entered at my broker - this should be done in excel...

Kind regards
Matthias
profile picture

Eugene

#4
In this case, check this out:

Community Components > Import real (historical) trades > Import the history of real trades from Wealth-Lab's Accounts tool

Scroll down to the C# example, "Import from Accounts tool" section. With this method you can make your Strategy import the history of real trades submitted straight from Wealth-Lab's Accounts tool and convert it or simply take the auto-generated file ExportedTradeHistoryFromAccounts.csv for opening in Excel.
profile picture

Supersol

#5
Dear Eugene,

We dont want to Import historical trades, we want to export the trades which are visible in alert tab to CSV. In screenshots attached you see our approach. We are already accessing the alert object, but what is written out to CSV does not match the alert tab in WL.

thx
Supersol
profile picture

Eugene

#6
Hi Matthias,

I've got confused by your repeating mix of the words "trade" and "Alert". Trades != Alerts. Now it's clear. The Shares property always returns 1 while the Strategy is executing. This is by design. In portfolio simulation mode all trades are pre-executed with 1 share per Position, and then position sizing is applied after the strategy has finished executing.

So if you wish the numbers to match the Alerts tab, you have to right click on the Alerts tab, copy, then paste to Excel. The Strategy output will not match (unless using precisely "1 share").
profile picture

Supersol

#7
Dear Eugene,

Sorry for the confusion..

1.
We would like to automatically export the alerts as seen in the alert tab and not via some right click, copy.. paste.. so is that possible by code?

2.
We would also like to run the backtest for several strategies automatically and scheduled (e.g once a day) - so that the alerts are exported - is that possible, too?

thx
Supersol
profile picture

Eugene

#8
The answer is yes to both questions. There are two alternatives:

1. Develop a custom performance visualizer (to run in a Strategy window):

Performance Visualizer API (PDF)
MS123 Visualizers (demo source code)

2. Run your Strategy in the Strategy Monitor and parse its config file StrategyMonitorConfiguration.xml to extract the Alerts. I know this is not the best example but at least it's something to start with:

Get DataSet Name and Symbol