PureBytes Links
Trading Reference Links
|
> If BarsSinceEntry > 0 then begin
No, that won't work. The question concerned hitting two orders on
one bar. In order for those orders to be active, they had to be set
on the PREVIOUS bar. On that previous bar -- when you would have to
be doing your BarsSinceEntry test -- NEITHER of the orders have been
hit, since they aren't active yet. BarsSinceEntry will refer to the
current or previous position on that bar, if any.
In other words,
* on bar N you issue your orders.
* on bar N, BarsSinceEntry refers to a previous position.
* on bar N+1, the orders you issued on bar N can be hit.
* on bar N+1, you CANNOT prevent one or the other order from
being taken by checking BarsSinceEntry, since the orders are
hit BEFORE your system logic is called on that bar. Your
system code gets called at the CLOSE of the bar, so by the
time you check BarsSinceEntry on bar N+1, both orders have
already been hit and executed.
Gary
|