GetOrderCloseTime
Syntax
GetOrderCloseTime(): TDateTimeReturn Value
Description
Example
// Select a historical order
if (
this.api.SelectOrder(
5,
EOrderSelectMode.SELECT_ORDER_BY_POS,
TSearchMode.DATA_MODE_HISTORY
)
) {
// Get the order's ticket number
const ticket = this.api.GetOrderTicket();
// Get the opening and closing times
const openTime = this.api.GetOrderOpenTime();
const closeTime = this.api.GetOrderCloseTime();
// Calculate the duration of the order (in days)
const duration = closeTime - openTime;
console.log(`Order #${ticket} details:`);
console.log(`- Opened: ${openDate}`);
console.log(`- Closed: ${closeDate}`);
console.log(`- Duration: ${duration.toFixed(2)} days`);
}Notes
Last updated