You have 2 Prints in your code
Print("Failed to place Buy 1 order, error#",GetLastError());
and
Print("Failed to place a buy cycle order, error#",GetLastError());
your error reports are
2015.10.12 11:08:49.210 2015.01.02 11:28 EURUSD,M1: Failed to place a buy stop order, error#4059 2015.10.12 11:08:49.210 2015.01.02 11:28 EURUSD,M1: OrderSend error 130 2015.10.12 11:08:49.210 2015.01.02 11:27 EURUSD,M1: Failed to place a buy stop order, error#4059 2015.10.12 11:08:49.210 2015.01.02 11:27 EURUSD,M1: OrderSend error 130
which cannot come from the code that you have posted
GumRai:
You have 2 Prints in your code
and
your error reports are
which cannot come from the code that you have posted
Sorry, it is the same Print() for the
if(XYZ) { int buystopiii=OrderSend(Symbol(),OP_BUYSTOP,lotsize,BuyOrderOpenPrice()+X,3,BuyOrderStopLoss()+Y,BuyOrderTakeProfit()+Z,"Buy stop order",MagicNumber,0,clrBlue); if(buystopiii>0) Sleep(3000);PlaySound(NULL); if(buystopiii<0) { PlaySound("alert2"); Print("Failed to place a buy cycle order, error#",GetLastError()); } }
I have double checked this.
Error report returns:
EURUSD,M1: Failed to place a buy cycle order, error#4059 EURUSD,M1: OrderSend error 130 EURUSD,M1: Failed to place a buy cycle order, error#4059 EURUSD,M1: OrderSend error 130
Can you see anything incorrect in my code?
Capture the Last Error before it could be clobbered by the PlaySound. PlaySound("alert2"); Print("Failed to place a buy cycle order, error#",GetLastError());
- Print out the OrderSend parameters and Ask and Bid to find out why.
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
Hey guys,
I seem to be having a bit of a problem, and any help is appreciated.
I am constantly getting OrderSend() errors 130 which I presume to be (ERR_INVALID_STOPS) and 4059 while back testing..
Below is the code and please let me know where I am going wrong!
Essentially, I place an order, and later on if conditions are met I place a stop order. I retrieve the values from the original order and use them in the placement of the stop order.