Access Performance Metrics in Code
Author: ronc
Creation Date: 8/25/2013 12:08 PM
profile picture

ronc

#1
In the Performance Tab are various performance metrics. Currently, for each run, I take the Net Profit for All Trades and the Net Profit for Buy & Hold, manually type those into a spreadsheet, and run calculations on them. I do this for a large number of runs. Is there a way to access these data within my code, so that I avoid the manual data transfer and do the calculations directly in my code?

Thanks.
profile picture

Eugene

#2
In short, it's not possible. This is not supported by Wealth-Lab. You can not have access to the performance backtest results in Strategies because Strategy has already finished executing by the time Wealth-Lab gives control to Performance Visualizer.

However, experienced coders may use a workaround developed for programmatic access to the building blocks of a backtest in Strategies: WealthScript Techniques | Interacting Dynamically with Portfolio Level Equity. It focuses on plotting/trading the equity curve, but extracting a strategy's NetProfit is feasible in the same manner.

This example is for inline coding, but an existing saved strategy can also be loaded from disk (refer to the KB article above). To stress this once again, this is a totally UNSUPPORTED D.I.Y. excercise that takes certain effort and programming skills. Accuracy is also not guaranteed.

CODE:
Please log in to see this code.


If you want to have a deeper understanding, these conversations should keep you busy for awhile:

Access to data/stats normally displayed in the performance tab during a backtest
Trading by win rate and profit factor
Accessing SystemResults
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).