Download MetaTrader 5
To add comments, please log in or register
Sign up for MQL5.community to post your Forum topic
Sherif Hasan
7224
Sherif Hasan 2016.10.01 18:26 

I would like to run my ea on GMT input time. it shows error while i used following codes. please support me to fix the error?

int Today=-1;
extern Hour=12;
extern Minute=15;
datetime GMTtime = TimeGMT();
int hour = TimeHour(GMTtime);
int minute = TimeMinute(GMTtime);
if (DayOfWeek() != Today && hour == Hour && minute == Minute)
{
    Today = DayOfWeek();
    
}
Carl Schreiber
5966
Carl Schreiber 2016.10.01 19:09  

What error?

Why do you think it does not work?

Do you know your dst, the dst of your pc?

Do you know how to change the time of you pc?

Question after question...

Fernando Carreiro
1574
Fernando Carreiro 2016.10.01 19:19  
  1. You have "extern" but no datatype defined.
  2. "Hour" and "Minute" are reserved function names, try not to use them as variable names so that you don't create possible compile problems.
  3. It is unclear if this code in inside a function or just a the global level.
    1. If inside a function, then you can't have "extern" in it.
    2. If outside in the global scope, then you can't have executable code, namely the "Time???()", "if()", "DayOfWeek()", etc. outside of functions in the global context.

You should first learn coding in general, so that you can understand the basics of coding before trying to code your own Indicator or EA. It is of no use to anyone if you don't first learn the basics. This can take many months (even a couple of years), for a complete beginner, to properly learn to code Indicators or EAs. You need time to properly gain the necessary knowledge and coding experience for it. Obviously, if you are serious about it and have the dedication to stick with it, then go for it. But remember that it is a long-term project, and not short term.

If however, you are not serious about learning to code, or you need a solution quickly, then please consider hiring someone to code for you. Go to the Freelance section and place a Job advert, stating your budget and describing your requirements.

/
To add comments, please log in or register