The Ask value for close point is upper than particular candle

 

Hi,

I use this code for open an order

OrderSend(Symbol(), OP_SELL, 0.01, Bid, 3, 0, 0, "ORDER SELL", 10001,0, Red);

and use this code for close order:

OrderClose(OrderTicket(), OrderLots(), Ask, 3, Red);


The Ask value for close point is upper than particular candle(Attached file):

What is the problem and how can i fix it?

MQL5.community - User Memo
MQL5.community - User Memo
  • www.mql5.com
You can now not only read articles and download MQL5 programs, but you can also join discussions on the forum, leave comments on articles and source codes, rate MQL5 programs and share your own developments in the Code Base, and even publish articles for a decent fee (see Become an Author at MQL5.com!). MQL5.com services are constantly...
Files:
Capture.PNG  5 kb
 
Mohsen Shakeri:

The Ask value for close point is upper than particular candle(Attached file):

What is the problem and how can i fix it?

There is no problem, the candles are built with bid prices, not ask.

 
Mohsen Shakeri: The Ask value for close point is upper than particular candle(Attached file): What is the problem and how can i fix it?

There is no problem to fix.

You 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.
  1. 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?
  2. 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
  3. 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.)