- ago
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");
0
238
Solved
3 Replies

Reply

Bookmark

Sort
Glitch8
 ( 9.56% )
- ago
#1
It's a property of the Backtester class, and accessible like this:

CODE:
StrategyExecutionMode em = Backtester.ExecutionMode;
1
Best Answer
- ago
#2
Thanks Glitch! Btw... that is not documented here: https://www.wealth-lab.com/Support/ApiReference/Backtester
0
Glitch8
 ( 9.56% )
- ago
#3
I just added it to the documentation, thanks.
1

Reply

Bookmark

Sort