Shows error OrderSend(Symbol()
1. Look up the error code in the logbook.
2. extern double TPforSymbol = 0;
extern double SLforSymbol = 0;
variables equal zero.
The fact that the variables are zero is a profit and loss constraint, I don't think it matters here....
Hi all, who can help with the robot, why doesn't it work?
extern double lots = 0.01;
extern double TPforSymbol = 0;
extern double SLforSymbol = 0;
int last_bar = 0;
int start(){
if (last_bar == Bars) return(0);
last_bar = Bars;
if (OrdersTotal() == 0){
OrderSend(Symbol(), OP_BUY, lots ,Ask, 3, Bid - SLforSymbol * Point, Ask + TPforSymbol * Point, 0, Blue);
OrderSend(Symbol(), OP_SELL, lots ,Bid, 3, Ask + SLforSymbol * Point, Bid - TPforSymbol * Point, 0, Red);
}
return(0);
}
You can't by the rules of the language swallow parameters with default values. If you have to set the colour of the arrows, then write all the parameters to the left of the colour. B slippage 3 is not enough, if it is 5 digits, there will be requotes, I wrote 50. And SL and TP should be set to values other than zero.Aleksey Vakhrushev has already written about it.
OrderSend(Symbol(), OP_BUY, lots ,Ask, 50, Bid - SLforSymbol * Point, Ask + TPforSymbol * Point, "", 1, 0, clr Blue);
right =)
an order tries to place a stop and a stop at the same place as the price - which is impossible
- either do as below if you want 0
or specifyTPforSymbol, SLforSymbol
OrderSend(Symbol(), OP_BUY, lots ,Ask, 50,0, 0, "", 1, 0, clrBlue);
Hi all, who can help with the robot, why isn't it working?
Do you want the opening function to be correct or do you want to understand why there are errors?
It should open deals.
Deal with the variables
extern double TPforSymbol = 0;extern double SLforSymbol = 0;
With this value of variables you will get an error.
Alexey Volchanskiy wrote that you do not specify all parameters for the OrderSend() function.
extern double TPforSymbol = 100;
extern double SLforSymbol = 1000;
extern int stop_loss = 76;
extern int take_profit = 750;
intlast_bar = 0;
int start(){
if (last_bar == Bars) return(0);
last_bar = Bars;
if(OrdersTotal() == 0){
OrderSend(Symbol(), OP_BUY, lots ,Ask, 50, Bid - stop_loss * Point, Ask + take_profit * Point, "", 1, 0, clrBlue);
OrderSend(Symbol(), OP_SELL, lots ,Bid, 50, Ask+ stop_loss * Point, Bid - take_profit * Point, "", 1, 0, clrRed);
}
return(0);
}
Fixed it this way, but it's still wrong.....

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi all, who can help with the robot, why doesn't it work?
extern double lots = 0.01;
extern double TPforSymbol = 0;
extern double SLforSymbol = 0;
int last_bar= 0;
int start(){
if (last_bar == Bars) return(0);
last_bar = Bars;
if(OrdersTotal() == 0){
OrderSend(Symbol(), OP_BUY, lots ,Ask, 3, Bid - SLforSymbol * Point, Ask + TPforSymbol * Point, 0, Blue);
OrderSend(Symbol(), OP_SELL, lots ,Bid, 3, Ask+ SLforSymbol * Point, Bid - TPforSymbol * Point, 0, Red);
}
return(0);
}