Breaking the For Loop cycle. - page 4

 
TheHonestPrussian #:
So, as promised, the solution:
Essentially, if result = true, the EA will insert a button, and start calling the functions from the top o the OnTick section so you have the running order profit/loss for that position, plus it changes colour from red to green (or vice-versa) if you go from loss to profits (or vice versa).
Feel free to feedback/discuss if you have a more efficient way of doing this, but obviously no obligation.


Hello,
- from me is just about efficiency.

If a process is carried out immediately on every tick price change, 'Ontick()',
thenit can be a burden on your computer and connection to your broker.

The cooling fan on your computer will be noisy
because it is working hard to cool the processor :)

Fyi, when the market is busy, the price change per minute can reach 80-90 ticks or even more.
That means it is possible there are many quotes in every second.
You can prove it by writing a simple function to calculate how many ticks per minute.

Apart from that, what are the consequences if the process in the 'for' loop hasn't ended but
- the tick price suddenly changes rapidly many times?

It looks like OnTimer() via EventSetMillisecondTimer(<number of milliseconds>) or
EventSetTimer(<number of seconds>) can complete the task of that process more efficiently and safely.

Client Terminal Events - MQL4 programs - MQL4 Reference


Happy coding :)

Client Terminal Events - MQL4 programs - MQL4 Reference
Client Terminal Events - MQL4 programs - MQL4 Reference
  • docs.mql4.com
Client Terminal Events - MQL4 programs - MQL4 Reference
Reason: