Download MetaTrader 5
To add comments, please log in or register
Start making profit using the Market. Publish your product!
XXX
8
XXX 2016.02.12 22: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.
whroeder1
13593
whroeder1 2016.02.13 13: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.
Ovo Cz
2954
Ovo Cz 2016.02.14 09: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.

/
To add comments, please log in or register