PureBytes Links
Trading Reference Links
|
I am trying to set up a portfolio backtest to:
- Buy on the last trading day of each week the top 2 equities in a
watchlist, ranked by 100-RSI(2).
- Sell those 2 equities on the last trading day of the next week, and
replace them with 2 equities that satisfy the above rule.
(Note: EnableRotationalTrading() doesn't do the trick, because
I want to exit unconditionally at the end of the following week, not
because the current positions fall below a positionrank threshhold.)
I'm using the code below, and it almost works. Problem is that it
skips every other week. E.g., starting at the beginning of 2002, it
buys two stocks on 1/4/2002, and sells them on 1/11/2002. But it
doesn't buy anything on 1/11/2002. Instead, it buys 2 stocks again on
1/18/2002, and sells them on 1/25/2002. Doesn't buy anything on
1/25/2002. But, it buys 2 stocks on 2/1/2002, and sells them on
2/8/2002. Etc.
Suggestions?
Thanks,
David
-------------------------------------------------------------
SetOption("InitialEquity",100000);
SetOption("CommissionMode",1);
SetOption("CommissionAmount",0);
SetOption("MaxOpenPositions",2);
SetOption("MarginRequirement",100);
SetOption("UsePrevBarEquityForPosSizing",False);
SetOption("AllowPositionShrinking" , True);
SetOption("AllowSameBarExit",False);
SetTradeDelays(0,0,0,0);
BuyPrice = C;
SellPrice = C;
SetPositionSize(50,spsPercentOfEquity);
RoundLotSize = 10;
weekend = DayOfWeek()>Ref(DayOfWeek(),1);
RSI2 = RSIa(C,2);
PositionScore = 100-RSI2;
Buy = weekend;
Sell = weekend;
------------------------ Yahoo! Groups Sponsor --------------------~-->
Has someone you know been affected by illness or disease?
Network for Good is THE place to support health awareness efforts!
http://us.click.yahoo.com/Rcy2bD/UOnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~->
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|