MQL4 (in Strategy Tester) - double testing of entry conditions

 

Hi all,

I would need to double-test the entry condition in my EA. The condition is the same but I want to test its validity with a time delay.

for example:

if(OPEN_CONDITION){
        time_delay (2s);
        if(OPEN_CONDITION){
                OrderSend();
        }
}

Sleep() function does not suspend execution of the EA in the Strategy Tester.


Any idea for this?

Operation of Programs in the Strategy Tester - MQL4 programs - MQL4 Reference
Operation of Programs in the Strategy Tester - MQL4 programs - MQL4 Reference
  • docs.mql4.com
There are operation limitations for some functions in the client terminal's Strategy Tester. Calling that functions leads to error 4059 (Function is not allowed in testing mode). The Sleep() Function The Print() and PrintFormat() Functions To increase performance, Print() and PrintFormat() functions are not executed when optimizing the trading...
 
You are looking at a signal. Look for a change of signal, with delay.
 static bool openCondition=false; static datetime firstSeen;
 bool prevCondition = openCondition; openCondition = OPENCONDITION;
 if(openCondition){
    if(!prevCondition) firstSeen = TimeCurrent(); // Remember first seen
    else if(TimeCurrent() - firstSeen >= 2){      // Still set for 2 seconds
                 OrderSend();
         }
 // else                                          // still waiting.
 }
 
William Roeder #:
You are looking at a signal. Look for a change of signal, with delay.
I looked for the Time_delay but there is no such command?
 
Daniel Costa #: I looked for the Time_delay but there is no such command?
What part of “Still set for 2 seconds” is unclear to you?
 
William Roeder #:
What part of “Still set for 2 seconds” is unclear to you?
Sorry was responding to a previous post you sent me regarding this... thanks i will try this..
 
William Roeder #:
You are looking at a signal. Look for a change of signal, with delay.
It doesn't work. I have tried it multiple times
 
Worldwide Fox #: It doesn't work. I have tried it multiple times
  1. “Doesn't work” is meaningless — just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires — meaningless.
         How To Ask Questions The Smart Way. (2004)
              When asking about code
              Be precise and informative about your problem

  2. Do you really expect an answer? There are no mind readers here and our crystal balls are cracked. Always post all relevant code (using Code button) or attach the file.
         How To Ask Questions The Smart Way. (2004)
              Be precise and informative about your problem

    We can't see your broken code.

 
William Roeder #:
  1. “Doesn't work” is meaningless — just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires — meaningless.
         How To Ask Questions The Smart Way. (2004)
              When asking about code
              Be precise and informative about your problem

  2. Do you really expect an answer? There are no mind readers here and our crystal balls are cracked. Always post all relevant code (using Code button) or attach the file.
         How To Ask Questions The Smart Way. (2004)
              Be precise and informative about your problem

    We can't see your broken code.

It doesn't work. That's true.
And I see lots of people asking this question and you provide them this link to an explanation that doesn't work. 
It's mql5 question
 
Worldwide Fox #: you provide them this link to an explanation that doesn't work.

Prove it.