Code execution speed

 
Hello! I have one question, I have this EA, and OnTick() running time is 375 msec when all functions inside are used . Is it good is it slow? What do you think? Thanks
 
Daniel Cioca:
Hello! I have one question, I have this EA, and OnTick() running time is 375 msec when all functions inside are used . Is it good is it slow? What do you think? Thanks
I think: Potential to optimize.

I would guess a good coder could probably get it down below 200ms.

Without seeing the code, this is just pure guessing.

In general, I would say, anything that's below your network connections latency is good enough to handle the market. Because this way you won't have accumulating latency.

But, there are so many factors to consider, this is a very broad approach of judging the performance of a code.

Factors like the timeframe you are using for the relevant strategy, excluding news and so on would all need to be taken into account.

It's almost like asking "Is my car fast enough?"

Well, for what is the question....

Do you see the issue with your query?
 
Daniel Cioca: Hello! I have one question, I have this EA, and OnTick() running time is 375 msec when all functions inside are used . Is it good is it slow? What do you think? Thanks

Only you can answer that!

It depends on the strategy, time-frame, what it does, etc.

 
  1. Don't worry about performance, until you have a problem. Then, and only then, use the profiler, find the problem, fix the problem, and remeasure.

  2. EAs : Don't do per tick what you can do per bar, or on open.
    If you are waiting for a level, don't reevaluate, wait until price reaches it (or a new bar starts, and you recalculate.)
    If you are waiting for an order to close, only look when OrdersTotal (or MT5 equivalent) has changed.
              How to get backtesting faster ? - MT4 - MQL4 programming forum (2017)

  3. Indicators: Code it properly so it only recomputes bar zero (after the initial run).
              How to do your lookbacks correctly. (2016)
              3 Methods of Indicators Acceleration by the Example of the Linear Regression - MQL5 Articles. (2011)
    Or, reduce Tools → Options (control+O) → Charts → Max bars in chart to something reasonable (like 1K.)

 
Thank you very much!
Reason: