UpdateOrder

Modifies parameters of an existing order.

Syntax

UpdateOrder(orderTicket: number, priceOpening: number, stopLoss: number, takeProfit: number): boolean

Parameters

  • orderTicket: The ticket number of the order to modify.

  • priceOpening: New opening price for the order. Use 0 to keep the current value.

  • stopLoss: New stop loss level for the order. Use 0 to keep the current value or remove existing stop loss.

  • takeProfit: New take profit level for the order. Use 0 to keep the current value or remove existing take profit.

Return Value

Returns a boolean value indicating whether the order was successfully updated.

  • true: Order was successfully updated.

  • false: Order update failed.

Description

The UpdateOrder method allows you to modify parameters of an existing order, such as stop loss and take profit levels. This is useful for implementing trailing stops or adjusting risk parameters as market conditions change.

Example

Notes

  • You must have a valid order ticket to modify an order.

  • Order modification may fail due to various reasons such as invalid price levels, insufficient margin, or if the order has already been closed.

Last updated