MT4 DLL Question

 
I have just been writing a  test DLL . I have a question regarding the arraycopyrates function.

When arraycopyrates is used to pass address of mqlrates array structure is this pointer then fixed for the duration of EA execution?

i.e. can we safey just use arraycopyrates in the EA init function to pass address to DLL just once or does/could MT4 reallocate memory at any point regarding rates which means arraycopyrates should in theory be called every tick i.e. within MT4 start function.
 
  1. New bars must be added, so of course the buffer will have to be reallocated. The MqlRates array points to the new buffer.
  2. You do not need to call ArrayCopyRates per tick, you need to pass the array per tick.
 
cyborg1999:
I have just been writing a  test DLL . I have a question regarding the arraycopyratesfunction.

When arraycopyrates is used to pass address of mqlrates array structureis this pointer then fixed for the duration of EA execution?

i.e. can we safey just use arraycopyrates in the EA init function topass address to DLL just once or does/could MT4 reallocate memory at anypoint regarding rates which means arraycopyrates should in theory becalled every tick i.e. within MT4 start function.

Nearly all MQL functions are working on chart buffers copy, so they stay unchanged during the OnTick function. However, I am not sure if the other event functions refresh the buffer or not (like OnChartEvent or OnTimer).

You may also force the update during the event with RefreshRates() function.

Reason: