The Modify method of TOrder objects allows you to make changes to existing conditional orders. It has 2 parameters:
1. Rate : TTrade – the modified order rate.
2. Amount: Double — the modified number of lots.
Note that for Stop and Limit orders Amount value is disregarded (as it cannot be changed). You still have to input some value, although it will not be used.
Example:
You have an object Ordr: TOrder, that holds an order. To modify this order, you need the following line:
Ordr.Modify(1.6250,3); |
The order rate will be changed to 1.6250, and the Amount will be changed to 3.
Example: Let us create a strategy that will shift the rate of every order in the order list 2 points down, and change the Amount into 3.
const StrategyName = 'Orders';
procedure OnStart; var i: Integer; begin for i:=0 to OrderList.Count-1 do OrderList.Get(i).Modify(OrderList.Get(i).Rate – 2*OrderList.Get(i).Instrument.PointSize, 3); end; |