MT4 DLL Question

Back to topics list To post a new topic, please log in or register
avatar
2
cyborg1999 2016.02.12 23:41
 
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.
avatar
12983
WHRoeder 2016.02.13 14:42 #
 
  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.
avatar
1109
Ovo 2016.02.14 10:21 #
 
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.

Back to topics list  

To add comments, please log in or register