PureBytes Links
Trading Reference Links
|
<<<
just hoping there might have been an undocumented function which would have
made the process a little easier.
>>>
not that I'm aware of.
<<<
that works fine - of course it isn't quite as easy with a limit order where
you don't know whether your order was executed except by testing prices on
subsequent bars.
>>>
O.K. Then maybe this would work. I don't use limit orders but assuming that
limit orders are good til filled, the code could go something like this.
{...as long as buyhit=1, this is the entry currently active....}
vars:buystop(0),buyhit(0),mp(0),lim(0);
mp=marketposition;
lim=5;
if mp<>1 then buyhit=0;
if conditionQ then buystop=0;
if conditionX then begin
buystop=C+lim;
{limit order goes here}
end;
if H>=buystop and buystop>0 then begin
if L<=buystop then buyhit=1
else buyhit=0;
buystop=0;
end;
dbs
|