Have you tried this?
start() { datetime time1 = TimeLocal(); ... // Your code ... datetime time2 = TimeLocal(); int elapsed = time2 - time1; Print( "Execution time " + elapsed + " seconds" ); }
More correct to use GetTickCount()
Depending on your CPU, your EA could run as many as one million times per second,
so counting seconds is not really good for anything. Of course if there is trading
(opening/closing) involved, it depends solely on brokers execution, wich can take
up to 10 minutes.
If you want to know the speed of calculations in your EA, use an infinite loop script. Here is what I use:
(Compile it as a Script! It will show in the comment line, how many times the loop could run in a whole second)
If you want to know the speed of calculations in your EA, use an infinite loop script. Here is what I use:
(Compile it as a Script! It will show in the comment line, how many times the loop could run in a whole second)
int runs=0; int i; int start() { //---- int t=TimeLocal(); Comment("_"); while(!IsStopped()) { if (TimeLocal() > t) if (counter())break; } //---- Comment (runs); return(0); } //+------------------------------------------------------------------+ bool counter() { int t=TimeLocal(); while(!IsStopped()) { runs++; if (TimeLocal() > t) break; //----------------------- //put your code here //----------------------- } return(true); }

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I haven't found an exact answer to this, but would I be correct in assuming that the execution speed of an EA is determined by the client computer? If so, is there a way to determine how long it takes the EA to process a new tick?
Thanks
Nick