Good afternoon!
please tell me if it is possible to get the specified subject in the code of the adviser?
it is necessary to disable certain filters in different modeling modes, for example, when testing for closures, it makes no sense to process
functions related to ticks.
fxsaber
Forum on trading, automatic trading
systems and testing of trading strategies
Language features
mql5, subtleties and techniques
fxsaber, 2017.11.23
00:21
// returns true only if the real tick mode is selected (in the tester)
// Before using it, there must be at least one ontick called by the tester
bool IsRealTicks( void )
{
MqlTick Tick;
return(SymbolInfoTick(_Symbol, Tick) && (Tick.volume || !(Tick.flags & TICK_FLAG_LAST)));
}
Usage example
// The Expert Advisor will only be tested in real tick mode
Howvoid OnTick()
{
static bool IsRemove = true;
if (IsRemove)
{
IsRemove = MQLInfoInteger(MQL_TESTER) && !IsRealTicks();
if (IsRemove)
{
Print("Real ticks mode is needed!");
ExpertRemove();
return;
}
}
//........
}
to do this in OnInit (without onTick) – I do not know.
You can also use mttester.mqh to get all the settings of the Tester in the Expert Advisor, if it is running on a local Agent.
marketeer
A long time ago (when there was still a service desk), I asked for such a check via the API. They said they didn’t need it. they offered to write their own algorithms for
determining the mode by time and number of ticks.