|
Hi, at start i want say thank you for your great job you're doing to help us to learn programming MQL4.
I've got problem. My First EA is not working correct. When MA lines getting crossed, MT try to open order but such error occurs every time:
2006.04.19 13:14:12 My_First_EA EURUSD,M1: Error opening SELL order : 4109
It is the same with Long position.
#define ERR_TRADE_NOT_ALLOWED 4109
I know it is connect with these lines of code:
if(isCrossed == 2)
{
ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,Bid-TakeProfit*Point,"My EA",12345,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);
}
But i can't get it why this error occurs. I would be pleased if you could help me. Best Wishes.
|