![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi, I have the following error using the Strategy Tester.
TestGenerator: unmatched data error (volume limit 285 at 2008:04:15 15:23 exceeded).
Where is the problem?
I'm working on the following EA. Thank you.
extern double TakeProfit = 30;
extern double StopLoss = 20;
extern double Lots = 0.1;
int start()
{
double Macd_1, Macd_2, Macd_3, Macd_4, Ma_Quick, Ma_Slow;
int cnt, ticket, total;
Macd_1 = iMACD(NULL,0,3,20,9,PRICE_CLOSE,MODE_MAIN,1);
Macd_2 = iMACD(NULL,0,3,20,9,PRICE_CLOSE,MODE_MAIN,2);
Macd_3 = iMACD(NULL,0,3,20,9,PRICE_CLOSE,MODE_MAIN,3);
Macd_4 = iMACD(NULL,0,3,20,9,PRICE_CLOSE,MODE_MAIN,4);
Ma_Quick = iMA(NULL,0,20,0,MODE_EMA,PRICE_CLOSE,0);
Ma_Slow = iMA(NULL,0,65,0,MODE_EMA,PRICE_CLOSE,0);
// check for long position (BUY) possibility
if(Macd_1 > Macd_2 && Macd_2 < Macd_3 && Ma_Quick > Ma_Slow && Ask > High[1] && Macd_2 < 0
||
Macd_2 > Macd_3 && Macd_3 < Macd_4 && Ma_Quick > Ma_Slow && Ask > High[2] && Macd_3 < 0 )
{
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,NULL,Ask-StopLoss*Point,Ask+TakeProfit*Point,"macd sample",16384,0,Green);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)){
Print("BUY order opened : ",OrderOpenPrice());
}
else Print("Error opening BUY order : ",GetLastError());
return(0);
}
}
// check for short position (SELL) possibility
if(Macd_1 < Macd_2 && Macd_2 > Macd_3 && Ma_Quick < Ma_Slow && Bid < Low[1] && Macd_2 > 0
||
Macd_2 < Macd_3 && Macd_3 > Macd_4 && Ma_Quick < Ma_Slow && Bid < Low[2] && Macd_3 > 0 )
{
ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,NULL,Bid+StopLoss*Point,Bid-TakeProfit*Point,"macd sample",16384,0,Red);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) {
Print("SELL order opened : ",OrderOpenPrice());
}
else Print("Error opening SELL order : ",GetLastError());
return(0);
}
return(0);
}
}
// the end.