Closing position with the MT5 Web API

 

Hello guys,

I'm trying to close a Sell position via the MT5 Web API, but i'm getting the following error:  {"retcode"=>"3 Invalid parameters"}

I'm programming ruby and fetching the open/closed positions is already working. For this request I'm using the " /api/dealer/send_request" endpoint with the following params:

bid = api_client.symbol_info_tick("USDCHF").first.fetch("Bid")

attributes = {
  Action:         200,
  Digits:         5,
  Symbol:         "USDCHF",
  SourceLogin:    1234,
  Login:          410553,
  Type:           0, # BUY
  Position:       "2525579",
  PriceOrder:     bid,
  PriceDeviation: 20,
  Volume:         100
}
api_client.send_request(attributes)
I'm hoping somebody can help, the little descriptive error message makes it really difficult to debug this problem.

Thanks in advance!
 
Matt King: I'm trying to close a Sell position via the MT5 Web API, but i'm getting the following error:  {"retcode"=>"3 Invalid parameters"}.I'm programming ruby and fetching the open/closed positions is already working. For this request I'm using the " /api/dealer/send_request" endpoint with the following params:I'm hoping somebody can help, the little descriptive error message makes it really difficult to debug this problem.
MetaQuotes does not provide a Web API for MetaTrader terminal. It seems you are using an a 3rd party API, so please refer to them with your query.
 
Fernando Carreiro #:
MetaQuotes does not provide a Web API for MetaTrader terminal. It seems you are using an a 3rd party API, so please refer to them with your query.
Hello Fernano, thanks for your reply. I think that's not totally true. I have available documentation after a login at https://support.metaquotes.net/en/docs/mt5/api/webapi_main/webapi_trading/webapi_trade/webapi_dealer_send
But maybe that is because we have an own MT5 server via a broker.
 
Matt King #Hello Fernano, thanks for your reply. I think that's not totally true. I have available documentation after a login at https://support.metaquotes.net/en/docs/mt5/api/webapi_main/webapi_trading/webapi_trade/webapi_dealer_send But maybe that is because we have an own MT5 server via a broker.

That is for the MetaQuotes back-end or broker side server software. This forum and this site is for the front-end terminal software, not the back-end.

You have posted your query in the wrong forum/website. We cannot help you here. Post your query at whatever site/forum is provided for back-end support. Not here.

 
Fernando Carreiro #:

That is for the MetaQuotes back-end or broker side server software. This forum and this site is for the front-end terminal software, not the back-end.

You have posted your query in the wrong forum/website. We cannot help you here. Post your query at whatever site/forum is provided for back-end support. Not here.

Ok thank you, will do! Have a nice day