I have been trying to place a sell order through my EA and have run into several issues.
Here is my current code, I get failed market sell 100.00 EURUSD sl: 1.12718 tp: 1.12743 [Invalid request] and retcode of 10013.
I changed my volume to 1000 and then got an invalid volume error, so i changed to .01 and then i got an invalid stops error.
Thanks in advance for any help.
static double price;
price = Latest_Price.bid;
request.action = TRADE_ACTION_DEAL;
request.magic = 3;
request.price = NormalizeDouble(Latest_Price.bid, Digits());
request.type = ORDER_TYPE_SELL;
request.symbol = Symbol();
request.volume = 100;
request.type_filling = ORDER_FILLING_FOK;
request.price = 0;
request.tp = + price + .0001;
request.sl = price - .00015;
Print("Open Sell Order");
Print("Result code is " + result.retcode);
request.volume = NormalizeDouble(lots,2);
for SL and TP
double SL = 300;
request.sl =NormalizeDouble (price + SL *_Point,_Digits); //for sell
You also need to zero your request like this:
And then you have set the price to 0 before sending the order. Leave it as is (at the bid).
// request.price = 0;