Help with Time Please

 

Hi, I would like an EA to trade at a particular time e.g. 16:15

How do I code this?

Am using "extern double nFromHourTrade = 16;" but it will not accept minutes in the value specified. Any help appreciated

Many thanks

 

Enter your date as an external string, then use StrToTime();

var1=StrToTime("17:35"); // returns the current date with the given time

 

Thanks Michel. Will try it out

 
hoosain:
Hi, I would like an EA to trade at a particular time e.g. 16:15

How do I code this?

Am using "extern double nFromHourTrade = 16;" but it will not accept minutes in the value specified. Any help appreciated

Many thanks

I checked Gordago software and they have two indicators:

- DayOfWeek; and

- PeriodOfTime.

They are using these two indicators in Trading News strategy.

I converted 2 indicators and EA (working on M15 timeframe only) for MT4.

We may use these indicators in the folowing way:

double diCustom8=iCustom(NULL, 0, "DayOfWeek", 5, 0, 0);[/CODE]

where 5 is Friday.

We are trading on Friday if:

diCustom8>0[/CODE]

As to hours and minutes so we may use as:

[CODE]double diCustom1=iCustom(NULL, 0, "PeriodOfTime", 13, 25, 1, 0, 0);

where

13 is hours;

25 is 25 minutes;

1 is interval in min; 1 for M1 timeframe.

We are trading at 13:25 if:

[CODE]diCustom1>0
Files:
 

Newdigital - Thank you so much. Really appreciate your help!

Reason: