Hi, vvj!
To identify an order executing you can use follow structure:
procedure OnStart;
begin
CreateEntryOrder(History.Instrument, Account, Amount, bsbuy, History.Instrument.buy+Point*Shift,
NullRate,NullRate, otEStop, 'Entrybuy');
CreateEntryOrder(History.Instrument, Account, Amount, bssell, History.Instrument.Sell-Point*Shift,
NullRate,NullRate, otEStop, 'Entrysell');
end;
procedure OnOrderChange(const Action: TDataModificationType; const Order: TOrder);
var i:integer;
begin
//output the order information into the log
if (Action=dmtInsert) then
begin
log('Entry order placed: '+order.tag);
log('Instrument: ' +Order.Instrument.Name);
log('Account: ' +Order.Account.ID);
log('Amount: ' +FloatToStr(Order.Amount));
log('Order rate: ' +FloatToStr(Order.Rate));
end;
end;
procedure OnTradeChange(const Action: TDataModificationType; const Trade: TTrade);
begin
// if a new trade opened
if Action=dmtInsert then
begin
if Trade.Tag='Entrysell' then
begin
log('Sell position has been placed');
end;
if Trade.Tag='Entrybuy' then
begin
log('Buy position has been placed');
end;
end;
end;