MT4 Build 509 - function IsTesting() doesn't WORK - WHY ?

 

Does the function IsTesting() work in MT4 platform Build 509 ?


When I use expression like the following, under tester there is no effect.

Under TESTER, when I make back tests I have still Alert displayed "This is not testing !!!". Why ?


if ( !IsTesting() )
{
Alert("This is not testing !!!");
return(0);
}
 
puncher: Under TESTER, when I make back tests I have still Alert displayed "This is not testing !!!". Why ?
PICNIC. Alerts are not displayed in the tester, they become prints in the journal. You see the alert because you are not testing.
   period.chart      = Period();                         #define CS_LIVE      0
   market.pair       = Symbol();                         #define CS_VISUAL    1
   if      ( !IsTesting() )   status.chart   = CS_LIVE;  #define CS_OPTIMIZER 2
   else  if( IsVisualMode() ) status.chart   = CS_VISUAL;
   else{                      status.chart   = CS_OPTIMIZER; ...
2013.07.23 07:50:34 2009.01.01 22:00 WHRea35 EURUSD,M15: Alert: cs=1
 
WHRoeder:
PICNIC. Alerts are not displayed in the tester, they become prints in the journal. You see the alert because you are not testing.
2013.07.23 07:50:34 2009.01.01 22:00 WHRea35 EURUSD,M15: Alert: cs=1


You think about Meta Trader 4 or Meta Trader 5 ?


My problem is under MT4 not MT5...


The problem is not only for Alert() function the problem is for IsTesting() function. I feel thaht MT4 Build 509 doesn't recognize if is the back tester started.

 

Of course I assumed your problem was MT4 as this is the MT4 forum. I've never used MT5.

It works just fine as my post showed. "Alert: cs=1" = Visual mode

Feelings are irrelevant - I just proved that 509 works in the tester.

 

IsTesting() works properly on build 509. For following code:

int start() {

   static int currenthour = -1;
   if (Hour() > currenthour && Minute() == 0)
      { test_of_IsTesting(); currenthour = Hour(); }

   return(0)

}

void test_of_IsTesting() {

   if (!IsTesting())
      Print ("Not in tester mode.");
      
   if (IsTesting())
      Print ("In tester mode.");
      
   return;
}

produces the following in the log/journal:

IsTesting test #1

So, as you can see, IsTesting() works in build 509.

 

I have still the same problem:


int init() {
    
    if ( IsTesting() )
    {
    Print("TESTUJĘ !!!");
    return (0);
    }
    
    if ( !IsTesting() )
    {
      Print("NIE TESTUJĘ !!!");
      return (0);
    }
    
}


I have still "NIE TESTUJĘ !!!" message under tester...

where I 've made the mistake in the above code?

 
puncher:

I have still the same problem:



I have still "NIE TESTUJĘ !!!" message under tester...

where I 've made the mistake in the above code?

Did you try Thirteen's code ? perhaps you need a tick, move your code to the start() function and try again . . .
 
RaptorUK:
Did you try Thirteen's code ? perhaps you need a tick, move your code to the start() function and try again . . .


I need this code in init() { } not under start() { } ... in init() the function IsTesting() is not recognized !
 
puncher:

I need this code in init() { } not under start() { } ... in init() the function IsTesting() is not recognized !

If you continue to type in RED I will assume you are angry are you ?

RaptorUK:
Did you try Thirteen's code ? perhaps you need a tick, move your code to the start() function and try again . . .

Did you ? did it work ? did you try it in start() ? does it work ?
 
  1. IsTesting() works fine in init() as I showed, and in start() as Thirteen showed in our logs.
  2. You keep doing the same thing and complaining that you get the same result. That is insane
  3. Again: the problem is NOT YOUR CODE. Post your log and/or screen shot.
 
puncher:

I need this code in init() { } not under start() { } ... in init() the function IsTesting() is not recognized !

Are you using the strategy tester built into MT4 or are you running an EA on broker's demo account by attaching the EA to an open chart?

IsTesting() works both in init() and start().

int init() {
   test_of_IsTesting();
   return(0);
}

void test_of_IsTesting() {

   if (!IsTesting())
      Print ("Not in tester mode.");
      
   if (IsTesting())
      Print ("In tester mode.");
      
   return;
}

IsTesting test #2