Download MetaTrader 5

MT4 DLL Question

To add comments, please log in or register
XXX
8
XXX  
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.
whroeder1
15336
whroeder1  
  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.
Ex Ovo Omnia
3263
Ex Ovo Omnia  
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.

To add comments, please log in or register