Can't send Take Profit and Stop loss values when posting new order to Dxtrade using Dxtrade API

Can't send Take Profit and Stop loss values when posting new order to Dxtrade using Dxtrade API

Manage alerts

Loading saved threads...

God'sfavour Idowu-Agida · External communityPost link
External question — Stack Overflow Stack Exchange Author: God'sfavour Idowu-Agida Original post: https://stackoverflow.com/questions/78130092 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. I've been working with dxtrade API for a while now but I can't seem to find how to send Take Profit and Stop Loss values while posting an order with dxtrade API. How do I define these take profit and stop loss fields in the body of the post order request? Your swift response will be highly appreciated. Here's DxTrade API documentation: https://demo.dx.trade/developers/#/ I've gone through the documentation thoroughly but couldn't find TakeProfit and Stoploss fields
Quote
Report
PFDsa · External communityPost link
External answer — Stack Overflow Stack Exchange Author: PFDsa Original post: https://stackoverflow.com/a/78143648 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. I was able to place stop loss and take profit using order type STOP and LIMIT, passing the position code in the body. Fill in the account and order code details along with the appropriate headers. Opening a position: { "account":"string", "orderCode": "string", "type": "MARKET", "instrument": "EUR/USD", "quantity": 10000, "positionEffect": "OPEN", "side": "BUY", "tif": "GTC" } Get the position code from the terminal or through the api, for stop loss { "account":"string", "orderCode": "string", "type": "STOP", "instrument": "EUR/USD", "quantity": 10000, "positionEffect":"CLOSE", "positionCode":"405148769", "side": "SELL", "stopPrice": 1.09240, "tif": "GTC" } Similarly take profit { "account":"string", "orderCode": "string", "type": "LIMIT", "instrument": "EUR/USD", "quantity": 10000, "positionEffect":"CLOSE", "positionCode":"405271029", "side": "SELL", "limitPrice":1.09300, "tif": "GTC" } Hope it helps!
Quote
Report

Post Reply

Quoted from Forex.com.bd-Editorial External answer — Stack Overflow Stack Exchange Author: PFDsa Source score (net votes, not local likes): 0 Original post: https://stackoverflow.com/a/78143648 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. I was able to place stop loss and take profit using order type STOP and LIMIT, passing the position code in the body. Fill in the account and order code details along with the appropriate headers. Opening a position: { "account":"string", "orderCode": "string", "type": "MARKET", "instrument": "EUR/USD", "quantity": 10000, "positionEffect": "OPEN", "side": "BUY", "tif": "GTC" } Get the position code from the terminal or through the api, for stop loss { "account":"string", "orderCode": "string", "type": "STOP", "instrument": "EUR/USD", "quantity": 10000, "positionEffect":"CLOSE", "positionCode":"405148769", "side": "SELL", "stopPrice": 1.09240, "tif": "GTC" } Similarly take profit { "account":"string", "orderCode": "string", "type": "LIMIT", "instrument": "EUR/USD", "quantity": 10000, "positionEffect":"CLOSE", "positionCode":"405271029", "side": "SELL", "limitPrice":1.09300, "tif": "GTC" } Hope it helps!

Cancel quote

Checking account access…