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
I try your script for 20 times. In majority of times the script work with no error
and two hedge positions opened. In two cases ,SELL position opened, but error
number 130 reported with terminal and BUY position did not opened. Thanks
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
#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);
}