Schedule Script

 

Hi, how I can schedule one script ? I will that the script start automatically on 14:35 PM

It is possible ? We must buy a external plugin for MT4 ?

Thanks for the Anwers, bye Guido 

 
Just have it wait until the time arrives.
void OnStart(){
   #define HR1435 52500
   #define HR2400 86400
   for(;;){
      if(_StopFlag) return;
      datetime now  = TimeCurrent();
      int      time = now - now % HR2400
      if(time >= HR1435) break;
      Sleep(1000);
   }
   RefreshRates(); // Update predefines

   Your Code
 
Hi there - I have copied this script into mine, but it reports the folioing error: "if - semicolon expected - for line if(time >= HR1435) break;

How can I fix this error?
 

There are not much lines without semicolon at the end.

Try it with the line before the line the compiler gives you.

 
Dtfrancis15:
Hi there - I have copied this script into mine, but it reports the folioing error: "if - semicolon expected - for line if(time >= HR1435) break;

How can I fix this error?

WHRoeder only provided an initial skeleton part of the code! You have to fill in the rest, including the function's termination or closing brace "}".

You need to learn the basics of programming in order to understand it and be able to use it!

 
FMIC:

WHRoeder only provided an initial skeleton part of the code! You have to fill in the rest, including the function's termination or closing brace "}".

You need to learn the basics of programming in order to understand it and be able to use it!

It's no wonder people get put of trying to lean these things with feedback like this....

 I have used this code in several scripts and it generates all sorts of errors every time.  Attached a screenshot as these all seem to not be what I was expecting from this.  The script looks logical but when added to my script to select variable and open orders, it just goes mad.

 

Admittedly, the editor does not recognise this copied and pasted in, so has to be hand typed for some reason. 

 
Dtfrancis15:

It's no wonder people get put of trying to lean these things with feedback like this....

 I have used this code in several scripts and it generates all sorts of errors every time.  Attached a screenshot as these all seem to not be what I was expecting from this.  The script looks logical but when added to my script to select variable and open orders, it just goes mad.

Admittedly, the editor does not recognise this copied and pasted in, so has to be hand typed for some reason. 

What is wrong with the feedback I gave?

WHRoeder gave you "skeleton" code. He did not give you a complete, fully tested, fool-proof solution. He just gave you an example starting point, so that you could then develop the rest on your own.

If you were capable and fully aware of the basics of coding, you would have spotted right away that the code is not complete and that there are a few things missing. It is not meant to be complete code and only a "template" or "pseudo-code" example.

You don't really expect him (or anyone else here for that matter) to provide complete solutions that have been fully tested, every time someone asks for advice - do you?

One would expected that you also put in the effort to do some work and research of your own and learn the basics at least, in order to spot what needs to be completed in order to achieve the desired result.

We are not going to be spoon-feeding you, so put in the effort!

 
Dtfrancis15:

It's no wonder people get put of trying to lean these things with feedback like this....

 I have used this code in several scripts and it generates all sorts of errors every time.  Attached a screenshot as these all seem to not be what I was expecting from this.  The script looks logical but when added to my script to select variable and open orders, it just goes mad.

 

Admittedly, the editor does not recognise this copied and pasted in, so has to be hand typed for some reason. 

WHRoeder endeavored to point you in a  direction rather than spoon feed and change your nappy. The point is to create 'learnings' rather than solutions.

 

PS

my approach would be to covert the Script into a Method (ie extraxt and rewrite) and then run the Method at the time desired in the  EA. 

I would set the Time by converting a String of the Time into a datetime 

Reason: