URGENT DateTime in MQL4

 

Can somebody help me on thefollowing two questions ;

1) I would like to write a code as follows

if current time > 5 hours 0 min 0 secs then .....

how I should write the code ?

2) In my EA I use 3 different timeframes : H4,H1,M5.

The Straegy Tester shows me only H4 and H1 and not M5 .

Can you explain why ?

Thanks in advance

 
    int bindDate = GlobalVariableGet("Date");
    if (bindDate != Day() && Hour() > 5) {
        // code here
        GlobalVariableSet("Date", Day());
    }
 
antslag wrote >>

Hi antslag for your quick reply, but I did not understand the

If (bindDate !=Day() ... because I want to trade in the current day,

but only after 5.00 hour :-).

What´s about the second question ?

Thanks again

Fabio

 

bindDate is previos date. it needs because to send order once of day

 
Fabio wrote >>

Hi antslag for your quick reply, but I did not understand the

If (bindDate !=Day() ... because I want to trade in the current day,

but only after 5.00 hour :-).

What´s about the second question ?

Thanks again

Fabio

Try to use Timeseries functions like iClose(), iTime() and so on. These functions let you use different time frame in your EA, and so you will be able to know the exact time in hours and minute.

 
antslag wrote >>

bindDate is previos date. it needs because to send order once of day

Thanks a lot for your help ;-)

Anyway I'm using just Hours() > 5 and it works, I think as I expect ;-)

 
Dainesi wrote >>

Try to use Timeseries functions like iClose(), iTime() and so on. These functions let you use different time frame in your EA, and so you will be able to know the exact time in hours and minute.

Thanks a lot ;-)

The problem was that I had to use with the strategy tester the M5 timeframe ;-)

Fabio

Reason: