I am receiving error 130 when I run my EA. Below is the code for buying:
The reason I am getting error 130 is that this places a buy stop two pips above the previous bar. When a candle closes near the high is when I get this error and sometimes the order never fills. Any ideas on how I could make this work when this happens?
Inserted Code
ticket=OrderSend(Symbol(),OP_BUYSTOP,Lots,HighBar1+BuySellBuffer*PointFive,3,0,0,"My EA",12345,0,Green);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());
OrderModify(OrderTicket(),OrderOpenPrice(),HighBar1-HighMinusLow-(StopBuffer*PointFive),HighBar1+TakeProfit2,0,Green);
}
else Print("Error opening SELL order : ",GetLastError());
return(0); The reason I am getting error 130 is that this places a buy stop two pips above the previous bar. When a candle closes near the high is when I get this error and sometimes the order never fills. Any ideas on how I could make this work when this happens?