I only want to send my custom emails when the strategy is running under Strategy Monitor. Is there a way to recognize this from code?
I've tried IsPricePane and ChartStyle == Null without success. Here's my code...
CODE:
Please log in to see this code.
Size:
Color:
PrintDebug is N/A in Strategy Monitor.
This approach (i.e. ChartStyle == null) from QuickRef > ChartStyle works flawlessly here. Regardless of the mode: single symbol and multi-symbol alike.
Size:
Color:
Hmmm You did a multisymbol backtest? Only works for single symbol for me. Multisymbol backtest acts like Strategy Monitor.
And it's surprising that yours works because the QuickRef says, "If the Strategy is run in a context where there is no chart (such as the Strategy Monitor or a Multi-Symbol Backtest), this property returns null."
Size:
Color:
Size:
Color:
We're getting there. Thanks for your help.
I need a function that returns true for Strategy Monitor, but false for every other case that may run a strategy, SSB, MSB, Optimizer, etc.,
I want to be able to make changes to and test a strategy, using SSB or MSB, without sending email.
"return ChartStyle == null;" returns true for Strategy Monitor and also MSB, false for SSB. So, I send emails whenever I run a test with MSB, which I don't want.
Size:
Color:
There is no
such function. SM, MSB and Optimizer are alike - there is no chart. SSB has charts.
Here's how to detect Optimization:
CODE:
Please log in to see this code.
Let me see if I find a key to tell SM from anything else using Reflection...
Size:
Color:
Thanks again. Perhaps this thread should be retitled, "How to detect Strategy Monitor execution".
One work-around is to just add a parameter that is only set to "1" in Strategy Monitor, having the benefit of working even if form attributes change in future releases. This was my original thought.
Size:
Color:
IMHO your solution is by far the easiest. :)
Size:
Color:
I had same need to distinguish is my WL script run in Strategy Monitor, SSB or MSB mode.
Suggestions/code I found at forum and FAQ were some way incomplete so I wrote my own function.
It's using ideas and posts including FAQ and this
http://www.wealth-lab.com/Forum/Posts/29114with some extra.
CODE:
Please log in to see this code.
Please notice:
1) The function based on current WL behaviors and GUI object names, which may be changed by WL developers later.
2) This function can't detect SM when StrategyMonitor is not active window.
In case you started SM but later open a regular strategy window on top this function will return SSB/MSB while actually it may be in "SM".
So this function should be used as SM detector only when SM is the only strategy running window opened in WL.
Size:
Color:
Vlad,
Thanks for sharing this! Now the question is, will this code work in Wealth-Lab Pro. Can't check it right now but the names of some controls (pnlTree, cmbSymbol)
may be obfuscated in WLP:
CODE:
Please log in to see this code.
Size:
Color:
Ummm... in case it fails I see workaround, at least for StrategyMonitor detection:
there is "Symbol" text label at left to drop-down box. It probably can be found enumerating controls by its constant text.
And that label has same habit: its text disabled/grayed during StrategyMonitor activity :)
Size:
Color:
ATTENTION: Community Components has a new GetMode function since v2017.09. It supersedes the Wiki article and related forum conversations. Thanks vladl2015 for the code.GetMode
Size:
Color: