OrderClose() on my price

 

Hi

I would like to ask you, it is possible to setup OrderClose() on my price not Ask or Bid? When i try to close position on my price i receive error 138, because actually price is different then my. It is possible to setup "pending close" something like pending buy - OP_BUYLIMIT ?


Thx for help.

 
A pending close is called either a 'Stop Loss' or 'Take Profit'. But you can still get slippage...
 
lukibest:

Hi

I would like to ask you, it is possible to setup OrderClose() on my price not Ask or Bid? When i try to close position on my price i receive error 138, because actually price is different then my. It is possible to setup "pending close" something like pending buy - OP_BUYLIMIT ?


Thx for help.


You can close your Buy or Sell trade with OrderClosePrice() instead of Ask or Bid

and it is Delete pending

 
i'm not sure you understand my problem. for example: I already buy one lot and after few bars later I want to close position but not actually price but for my price ( doesn't matter it will be close or not, If not then after few minutes later i will close by ASK/BID price, but i want send order to close position with my price). When i sent OrderClose(ticket, orderSize,price-0.0033, 3,Green); i receive error 138.
 
lukibest:
i'm not sure you understand my problem. for example: I already buy one lot and after few bars later I want to close position but not actually price but for my price ( doesn't matter it will be close or not, If not then after few minutes later i will close by ASK/BID price, but i want send order to close position with my price). When i sent OrderClose(ticket, orderSize,price-0.0033, 3,Green); i receive error 138.

Guess What ...... Who is closing the trade ??

You or is your broker closing the trade ??

If you try to close at other price then brokerprice then you have requote if the price you allow to close is not price of broker

The slippage you allow is not more then 3 points then it will be most likely you ask for receiving error 138

especially if you trade with broker that has a 5 digit notation for EURUSD Symbol()

Just learn what happens and what you are doing

 

:) yes i know who is closing the trade but i hope to find function similar to OP_BUYLIMIT when my order waiting for my price and then buy or not.

I want only to send my close order to broker with my price and when "broker price" will be the same (maybe in the 2h) then i will close position, if not the i will close by "broker price". \

But ok, if there is no function like this, then i will check all the time "broker price" and when "broker price" will be similar to my then i will close position by ASK/BID ;).

 
Paul_B:
A pending close is called either a 'Stop Loss' or 'Take Profit'. But you can still get slippage...
lukibest:

:) yes i know who is closing the trade but i hope to find function similar to OP_BUYLIMIT when my order waiting for my price and then buy or not.

I want only to send my close order to broker with my price and when "broker price" will be the same (maybe in the 2h) then i will close position, if not the i will close by "broker price". \


Use OrderModify() to set the Take Profit to the price you want to close the Order at.
Reason: