ordersend Help

 

i have write a EA small code get ordersend error 130 please tell me whta is the wrong with this

int BuyOrder1 = OrderSend(Symbol(),OP_BUY,0.01,NormalizeDouble(Ask,2),5,NormalizeDouble(Ask,2)-8*Point,NormalizeDouble(Ask,2)+ 18*Point,"Asanka Buy",16384,0,Green);
Alert(GetLastError());

 

https://book.mql4.com/appendix/limits

https://docs.mql4.com/trading/errors

Look for Error 130 from the Docs.

Follow the book check_list.

 
phpasanka:

i have write a EA small code get ordersend error 130 please tell me whta is the wrong with this

int BuyOrder1 = OrderSend(Symbol(),OP_BUY,0.01,NormalizeDouble(Ask,2),5,NormalizeDouble(Ask,2)-8*Point,NormalizeDouble(Ask,2)+ 18*Point,"Asanka Buy",16384,0,Green);
Alert(GetLastError());


What chart Symbol are you running the EA on?

Is it fair to assume that it is a Japanese pair. I assume that because or the normalize double to 2 decimal places.

Also have to assume that point with this Symbol ==0.01

If Point is 0.001, then the code is totally wrong.

int BuyOrder1 = OrderSend(Symbol(),OP_BUY,0.01,NormalizeDouble(Ask,2),5,NormalizeDouble(Ask,2)-8*Point,NormalizeDouble(Ask,2)+ 18*Point,"Asanka Buy",16384,0,Green);

/*
Probably better to use
NormalizeDouble(Ask,Digits)
If Point==0.001, Then you are trying to place a stoploss 8 points below Ask and that will probably not even cover the spread.
*/
 

thanks. . i removed "NormalizeDouble(Ask,2)-8*Point"

It's working

Reason: