My script does not work properly
What error do you get?
int start()
{
int error;
OrderSend(Symbol(),OP_BUY,0.1,Ask,0,Bid-m*Point,0,NULL,0,0,CLR_NONE);
error = GetLastError();
if(error != 0) Print("Error on buy = ", error);
OrderSend(Symbol(),OP_SELL,0.1,Bid,0,Ask+m*Point,0,NULL,0,0,CLR_NONE);
error = GetLastError();
if(error != 0) Print("Error on sell = ", error);
return(0);
}
| ERR_TRADE_NOT_ALLOWED | 4109 | Trade is not allowed. Enable checkbox "Allow live trading" in the expert properties. |
Uh....
Does your Dealer allow long and short positions at the same time?
It opens the long, but not the short?
Close the trades manually, try making the SELL before the BUY, see what happens
Try making the trades manually, see what happens
#property link "https://www.metaquotes.net/"
int g,m=10;
int start()
{
OrderSend(Symbol(),OP_BUY,0.1,Ask,0,Bid-m*Point,0,NULL,0,0,CLR_NONE);
OrderSend(Symbol(),OP_SELL,0.1,Bid,0,Ask+m*Point,0,NULL,0,0,CLR_NONE);
return(0);
}