PureBytes Links
Trading Reference Links
|
why not just make your own 'MyBarAtEntry(0)' variable, load it with
CurrentBar at (entry condition), and use CurrentBar - MyBarAtEntry, for you
exit tests.
regards, daver
-----Original Message-----
From: Brendan B. Boerner [mailto:brendan@xxxxxxxxxxxxxx]
Sent: Tuesday, July 01, 2003 1:34 PM
To: Omega-List
Subject: Open position, scaling out
Hello,
I'd like to do open a position @ the same time and then close it in
pieces 1, 2, and 3 months later.
I'm doing something like:
if (entry condition) then begin
Buy("1m") next bar at market;
Buy("2m") next bar at market;
Buy("3m") next bar at market;
end;
if MarketPosition = 1 then begin
if BarsSinceEntry >= 20 then begin
Sell("1mX" ) from entry ("1m") next bar at market;
end;
if BarsSinceEntry >= 40 then begin
Sell("2mX" ) from entry ("2m") next bar at market;
end;
if BarsSinceEntry >= 60 then begin
Sell("3mX" ) from entry ("3m") next bar at market;
end;
end;
The problem appears to be that I can't distinguish BarsSinceEntry for
a given entry (e.g. "1m", "2m", "3m") so that if <entry condition>
becomes true after I'm out of "1m" and I get back in, I immediately
exit.
Do I need to track my entries myself or am I missing something?
Thanks in advance for suggestions.
Regards,
Brendan
|