Is there a way to call a function in a DLL file (I'm using C++) and let it run while MT4 retains control.
Specifically, it's for a tick collector. I would like the DLL to periodically write the logs to file, but I don't want to miss any incoming ticks during the open/write/close process.
If not, the only solution seems to be to have two windows open per symbol.. either that or don't care so much.
Not all, but if it's possible, why not get the highest resolution? It gives me confidence that I'm catching all but the briefest of prices.
I feel it's useful for my high-frequency EA backtesting, and perhaps detecting foul play by a broker.
Not all, but if it's possible, why not get the highest resolution? It gives me confidence that I'm catching all but the briefest of prices.
I feel it's useful for my high-frequency EA backtesting, and perhaps detecting foul play by a broker.
Yes, but why? :)
Yes, sometimes I check with the ticks recorded per minute with the volume figure and it's about 5-10% dropped with this broker at peak times.
Any ideas on the original question?
@Ovo, actually after a bit more testing the dll is dropping more, but I'll keep on as the ticks collected are more realistic to what my EA (using dll) will receive. If MT4 can somehow retain control, all these issues will be solved.
Maybe I will try to figure out a way with 2 charts
Yes, sometimes I check with the ticks recorded per minute with the volume figure and it's about 5-10% dropped with this broker at peak times.
Any ideas on the original question?
Regarding DLLs ? no . . .
Regarding this ?
. . . but I don't want to miss any incoming ticks during the open/write/close process.
it can't be done . . . you will always miss ticks.
Regarding DLLs ? no . . .
Regarding this ?
it can't be done . . . you will always miss ticks.
Ok thanks, but I will try a few more things to see if I can reduce dropped ticks a bit.
Just testing some things I found something surprising. This little script takes 10 whole seconds to do the 9999 iterations
void start() { int tick = GetTickCount(); string log = ""; //first time for(int x=0; x<9999; x++) log = StringConcatenate(log,DoubleToStr(Bid,Digits),",",DoubleToStr(Ask,Digits),",",DoubleToStr(Volume[0],0),"\n"); //log = log+DoubleToStr(Bid,Digits)+","+DoubleToStr(Ask,Digits)+","+DoubleToStr(Volume[0],0)+"\n"; Alert(GetTickCount()-tick); return; }
I realise an average 1ms per iteration is nothing really but the dll does more operations and takes 0.5 secs to do 1,000,000 iterations.
EDIT: That's also faster than writing each tick's values straight to file with FileWrite (3 secs) or user32 (5 secs). That's with the file already open

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Is there a way to call a function in a DLL file (I'm using C++) and let it run while MT4 retains control.
Specifically, it's for a tick collector. I would like the DLL to periodically write the logs to file, but I don't want to miss any incoming ticks during the open/write/close process.
If not, the only solution seems to be to have two windows open per symbol.. either that or don't care so much.