Hello There,
I am not sure that why I am getting a retcode 10004 each time the EA is trying to place a sell order if the particular condition is met. I don't observe the same with buy positions. I even thought of using the deviation of 50 as I trading on EURUSD (5 digits) and applied the same still I see no hope.
Can someone please advise what could be possible wrong here.
Here is the piece of code that is placing the sell orders.
Regards,
Mohammad Imran Shamsi
When opening sell, your preferred price will be compared with the prevailing Bid. So normally, we want to supply Bid when we open sell.
So when you supply Ask, with deviation 50, you need to make sure that your spread is less than 50.
mrequest.price = NormalizeDouble(latest_price.ask,_Digits); // latest ask price mrequest.sl = NormalizeDouble(mrequest.price + STP*_Point,_Digits); // Stop Loss mrequest.tp = NormalizeDouble(mrequest.price - TKP*_Point,_Digits); // Take ProfitYou buy at the Ask and sell at the Bid. So for buy orders you pay the spread on open. For sell orders you pay the spread on close.
- Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid reaches it. Not the Ask. Your SL is shorter by the spread and your TP would be longer. Don't you want the same/specified amount for either direction?
- Your sell order's TP/SL (or Buy Stop's/Buy Limit's entry) will be triggered when the Ask
reaches it. To trigger at a specific Bid price, add the average spread.
MODE_SPREAD (Paul) - MQL4 programming forum - Page 3 #25 - The charts show Bid prices only. Turn on the Ask line to see how big the spread is (Tools → Options (control+O) → charts → Show ask line.)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello There,
I am not sure that why I am getting a retcode 10004 each time the EA is trying to place a sell order if the particular condition is met. I don't observe the same with buy positions. I even thought of using the deviation of 50 as I trading on EURUSD (5 digits) and applied the same still I see no hope.
Can someone please advise what could be possible wrong here.
Here is the piece of code that is placing the sell orders.
Regards,
Mohammad Imran Shamsi