EA does not receive every price tick?

 

I wonder if my EA did not see every price tick that MT4 has received, therefore missing some trading opportunities. So I wrote a test program which adds up the price ticks and calculates highs and lows in the previous time period on chart.

As I suspected, it did not see every price tick since the counter does not match the MT4 volume for that period....sometimes.

So the question is: is there anyway for EA to see every price tick that MT4 sees? Remember this is a simple and efficient EA test program.

Thanks.

 

Its possible that your EA's start() function was busy when some of the incoming ticks arrived. In which case the EA will ignore them.

If this is the case, then the answer would be to:

- Streamline the logic which is triggered by the start() function with each incoming tick

- Review the number of charts/platforms/other software, perform a capacity plan and upgrade infrastructure if necessary


CB

 
Show your test code.
 
cloudbreaker wrote >>

Its possible that your EA's start() function was busy when some of the incoming ticks arrived. In which case the EA will ignore them.

>>> Remember this is a very simple test program. It is not much logic but to increase counters. I'll show the program in reply to phy.

If this is the case, then the answer would be to:

- Streamline the logic which is triggered by the start() function with each incoming tick

- Review the number of charts/platforms/other software, perform a capacity plan and upgrade infrastructure if necessary

CB

 
phy wrote >>
Show your test code.

Here it is. It does not have much logic but to increase counter. So I wonder why it's missing price ticks. Any idea?

#property copyright "Taochiung Chi"
#property link ""

datetime lastBarTime;
double hiBid;
double loBid;
double hiAsk;
double loAsk;
int ticks;

//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
lastBarTime = 0;
hiBid = 0;
loBid = 0;
hiAsk = 0;
loAsk = 0;
ticks = 0;
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}

//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
if (Time[1] == lastBarTime)
{
//No new bar is formed. Price tick comes in current bar.
if (Bid > hiBid)
hiBid = Bid;
else if (Bid < loBid)
loBid = Bid;

if (Ask > hiAsk)
hiAsk = Ask;
else if (Ask < loAsk)
loAsk = Ask;

ticks = ticks + 1;
}
else
{
//New bar is formed. Display collected data.
if (ticks != Volume[1])
{
Alert("Volume (price tick counter) mismatched. EA: ", ticks, " MT4: ", Volume[1]);
PlaySound("alert.wav");
}

Comment("\nPrice ticks: ", ticks,
"\nBid highest: ", DoubleToStr(hiBid, 5), " lowest: ", DoubleToStr(loBid, 5),
"\nAsk highest: ", DoubleToStr(hiAsk, 5), " lowest: ", DoubleToStr(loAsk, 5));

//Reset variables.
lastBarTime = Time[1];
hiBid = Bid;
loBid = Bid;
hiAsk = Ask;
loAsk = Ask;
ticks = 1;
}

return(0);
}

 

Ok - I get you.

Can you post the log too?


CB

 
cloudbreaker wrote >>

Ok - I get you.

Can you post the log too?

CB

The Journal tab does not show anything. Here is the Experts tab when test program runs on EURGBP M5 chart:

2009.09.03 10:07:29 Chi_Debug_Recv_Ticks EURGBP,M5: Alert: Volume (price tick counter) mismatched. EA: 11 MT4: 13
2009.09.03 09:56:56 Chi_Debug_Recv_Ticks EURGBP,M5: Alert: Volume (price tick counter) mismatched. EA: 11 MT4: 12
2009.09.03 09:50:34 Chi_Debug_Recv_Ticks EURGBP,M5: Alert: Volume (price tick counter) mismatched. EA: 16 MT4: 17
2009.09.03 09:36:05 Chi_Debug_Recv_Ticks EURGBP,M5: Alert: Volume (price tick counter) mismatched. EA: 15 MT4: 17
2009.09.03 09:20:27 Chi_Debug_Recv_Ticks EURGBP,M5: Alert: Volume (price tick counter) mismatched. EA: 12 MT4: 13...........(start missing ticks from here)
2009.09.03 09:11:08 Chi_Debug_Recv_Ticks EURGBP,M5: Alert: Volume (price tick counter) mismatched. EA: 3 MT4: 14.............(ignore this)
2009.09.03 09:08:48 Chi_Debug_Recv_Ticks EURGBP,M5: Alert: Volume (price tick counter) mismatched. EA: 0 MT4: 8...............(ignore this)
2009.09.03 09:08:48 Chi_Debug_Recv_Ticks EURGBP,M5: initialized
2009.09.03 09:08:44 Chi_Debug_Recv_Ticks EURGBP,M5: loaded successfully

Any suggestion why my EA did not see every price ticks that MT4 has received? Thanks.

 

Ok. Since ticks will be discarded when start() is running it is possible that, lightweight as it is, your EA may be causing a tick to get discarded if it came very hot on the heels of the previous one.

Can you run 2 computers on the same network? Duplicate MT4 instance, same chart, same EA etc. However, one computer with natuarally or synthetically poor performance (shouldn't be difficult with MS-Windows).


CB

Reason: