Hi friends, sorry for my bad english:::
I'm developing an expert advisor that use a cross of 3 moving average baut i,ve a problem.
OrderSend do'nt start anithing value of stop loss or take profit is',nt 0 and restitue error 130.
Can you help me?
Here is the code
Hi,
ERR_INVALID_STOPS | 130 | Invalid stops. |
Cheers
Hi friends, sorry for my bad english:::
I'm developing an expert advisor that use a cross of 3 moving average baut i,ve a problem.
OrderSend do'nt start anithing value of stop loss or take profit is',nt 0 and restitue error 130.
Can you help me?
Here is the code
I can see a few issues and modified your code. Try this and let me know if it works:
int compra()
{
RefreshRates();
int ticket=OrderSend(Symbol(),OP_BUY,lotti,Ask,5,Ask-StopLoss*Point,Ask+TakeProfit*Point,"E' stata aperta una posizione long",101,0,Green);
if(ticket<0)
{
Print("Errore nella elaborazione ordine #",GetLastError());
return(0);
}
}
int vendi()
{
RefreshRates();
int ticket=OrderSend(Symbol(),OP_SELL,lotti,Bid,5,Bid+StopLoss*Point,Bid-TakeProfit*Point,"E' stata aperta una posizione short",101,0,Red);
if(ticket<0)
{
Print("Errore nella elaborazione ordine #",GetLastError());
return(0);
}
}
I can see a few issues and modified your code. Try this and let me know if it works:
int compra()
{
RefreshRates();
int ticket=OrderSend(Symbol(),OP_BUY,lotti,Ask,5,Ask-StopLoss*Point,Ask+TakeProfit*Point,"E' stata aperta una posizione long",101,0,Green);
if(ticket<0)
{
Print("Errore nella elaborazione ordine #",GetLastError());
return(0);
}
}
int vendi()
{
RefreshRates();
int ticket=OrderSend(Symbol(),OP_SELL,lotti,Bid,5,Bid+StopLoss*Point,Bid-TakeProfit*Point,"E' stata aperta una posizione short",101,0,Red);
if(ticket<0)
{
Print("Errore nella elaborazione ordine #",GetLastError());
return(0);
}
}
ther is the same error, but if i write int ticket=OrderSend(Symbol(),OP_SELL,lotti,Bid,5,0,0,"E' stata aperta una posizione short",101,0,Red); it'ok, if the value of take profit e stop loss is 0 the expert work correctly and send order, but i want to use stop and i do'nt understand where is the problem...
Thanks
Okay, what is the value in StopLoss and TakeProfit?
They should contain values based upon a number of pips (which you then multiply by Point to get the price) rather than a decimal value based upon a delta price.
Okay, what is the value in StopLoss and TakeProfit?
They should contain values based upon a number of pips (which you then multiply by Point to get the price) rather than a decimal value based upon a delta price.
at the begin of ea i declared variables extern double TakeProfit and extern double StopLoss with value 15 and 5 but i can modify value. the rest of your i did'nt understand ...
Thanks

- 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 friends, sorry for my bad english:::
I'm developing an expert advisor that use a cross of 3 moving average baut i,ve a problem.
OrderSend do'nt start anithing value of stop loss or take profit is',nt 0 and restitue error 130.
Can you help me?
Here is the code