The Terminate function can be used to abort the execution of the strategy. For instance, you may want for the strategy to stop in case on an order reject. In such case, the script should include the following lines:
procedure OnOrderChange(const Action: TDataModificationType; const Order: TOrder); begin if (Order.OrderType = otRejInit) or (Order.OrderType = otRejClose) then Terminate; end; |