PureBytes Links
Trading Reference Links
|
I'm trying to code a simple system that repeatedly buys at the Close
and sells at the next day's Open. It sounds simple, but I can't figure
out the correct combination of options to allow this.
My basic Buy/Sell criteria is:
Buy = True;
BuyPrice = Close;
Sell = Ref(Buy,-1);
SellPrice = Open;
-If I use SetOption("AllowSameBarExit", False) then I cannot sell and
buy on the same day, e.g. I cannot sell in the morning and buy the
same afternoon. The script will instead select different stocks to buy
even though the stocks sold that morning have a higher position score.
-If I use SetOption("AllowSameBarExit", True), then the above AFL buys
and sells on the same day instead of holding overnight.
-ExRemSpan(Buy,1) has the same problem as above, it can't sell & rebuy
on the same day.
-I thought SetOption("HoldMinBars",2) looked promising, but when I try
that I get an error message stating that I can't use HoldMinBar unless
AllowSameBarExit is also False. Again, see above.
Does anyone know how to do this? I've spent quite a bit of time on it
and I'm thinking it may be an oversight/limitation of the current AFL
language options. Thanks for any help,
-Joel
Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.14.11/542 - Release Date: 11/20/2006
|