It would be nice to have a property in UserStrategyBase (or perhaps in some other manner) that indicates the strategy is being run in the context of an optimizer. This would allow certain work in a strategy to be avoided in an optimization run. For example, not using ZigZagHL or similar indicators when they're only used for analysis in charts. Or, to avoid writing data to an external file, for analysis of single symbol, where you don't want to have to contend with n threads of optimization in your code.
For now, I use the following (called from Initialize):
public static bool IsOptimizing => new StackTrace().ToString().Contains("StrategyOptimizer");
For now, I use the following (called from Initialize):
public static bool IsOptimizing => new StackTrace().ToString().Contains("StrategyOptimizer");
Rename
It's a property of the Backtester class, and accessible like this:
CODE:
StrategyExecutionMode em = Backtester.ExecutionMode;
Thanks Glitch! Btw... that is not documented here: https://www.wealth-lab.com/Support/ApiReference/Backtester
I just added it to the documentation, thanks.
Your Response
Post
Edit Post
Login is required