EA coding, coming at it sideways. Basic EA structure, ticks, and wth am I doing?

From my understanding, init() allows you to create global variables, or set up your program “state” before starting the main loop. start() runs on each tick, which is where I would insert market logic, trades, and closes. deinit() allows me to cleanly exit - I’m assuming you’d put logging, database disconnects, and other cleanup stuff in there.

I’m guessing that MQL docs were written by a Russian. In Russian programming, MQL documentation reads you!

At any rate - I understand the syntax, it’s just been a struggle trying to figure out the next step. My plan is to create an EA that looks at the current second of the current minute. If the second is even, print Even, if Odd, print Odd.

Assuming for the time being that I don’t want to bother with init and deinit, my program looks like this:

int start()
  {
//----
   int myNumber = MathMod(Seconds(),2);
   Print(myNumber);
   if(myNumber==0) Print("EVEN");
   if(myNumber!=0) Print("ODD");
   Sleep(1000);
//----
   return(0);
  }

It’s a very simple routine that checks even/odd seconds and does something accordingly.

I can attach it to a chart fairly easily, and run it using the Expert Advisors button. I noticed that it doesn’t execute every second - there’s a seemingly random delay between executions of the start() function.

Is this because market ticks are irregular?

At any rate, I’m beginning to get a grasp of how EA’s interact with the platform. I’ll set up a naive/stupid trade automation sometime tonight, and hopefully I’ll be able to start implementing some real strategies by the end of the week.

(Neural networks, here I come!)