getTakeProfit (SDK Trading)
getTakeProfit is a Fintechee API to get the take-profit of the specific pending order or open trade.
- If the parameter is a pending order, then you get the take-profit of the pending order that you sent.
- If the parameter is a open trade, then you get the take-profit of the open trade that has been executed.
number
getTakeProfit(orderOrTrade) ⇒ EA SDK This function gets the take profit of the specific pending order or open trade. Phase (this API's scope): onTick | deinit
Kind: global function
Returns: number
- take profit.
Param | Type | Description |
---|---|---|
orderOrTrade | object | specific pending order or open trade |
getTakeProfit (SDK Trading)
registerEA(
"test_api",
"An EA to test APIs",
[],
function (context) { // Init()
},
function (context) { // Deinit()
},
function (context) { // OnTick()
var length = getPendingOrdersListLength(context)
for (var i = 0; i < length; i++) {
var pendingOrder = getPendingOrder(context, i)
if (pendingOrder != null) {
var tp = getTakeProfit(pendingOrder)
}
}
length = getOpenTradesListLength(context)
for (var i = 0; i < length; i++) {
var openTrade = getOpenTrade(context, i)
if (openTrade != null) {
var tp = getTakeProfit(openTrade)
}
}
})