GetOrderTakeProfit
Syntax
GetOrderTakeProfit(): numberReturn Value
Description
Example
// Select an order by ticket number
if (this.api.SelectOrder(12345, EOrderSelectMode.SELECT_ORDER_BY_TICKET)) {
// Get the order details
const symbol = this.api.GetOrderSymbol();
const type = this.api.GetOrderType();
const openPrice = this.api.GetOrderOpenPrice();
const stopLoss = this.api.GetOrderStopLoss();
const takeProfit = this.api.GetOrderTakeProfit();
console.log(`Order #12345 on ${symbol}:`);
console.log(`- Type: ${type === TTradePositionType.BUY ? "Buy" : "Sell"}`);
console.log(`- Open Price: ${openPrice}`);
console.log(`- Stop Loss: ${stopLoss}`);
console.log(`- Take Profit: ${takeProfit}`);
// Calculate potential profit in pips
const potentialProfitPips =
type === TTradePositionType.BUY
? (takeProfit - openPrice) * 10000
: (openPrice - takeProfit) * 10000;
console.log(`- Potential Profit: ${potentialProfitPips} pips`);
}Notes
Last updated