PureBytes Links
Trading Reference Links
|
I want to analyze some equities, as if I were buying and
holding them over a 10-year period, so that I can compare DD, Ulcer,
Sharpe, etc. To do this, I have to buy each day and then sell the
next. The problem I am running into is that I can buy on Day 1, then sell
on Day 2, but my system will not buy again until Day3 even though I set
MaxOpenPositions to 2. I've tried various combinations of parameters,
without any luck so far.
I've attached the AFL I am using. Does anyone have any
ideas on how to get this to work?
// Set commissions to 0 before running this<FONT face=Arial
size=2>
SetOption (<FONT face=Arial
color=#ff00ff size=2>"InitialEquity",
22000<FONT face=Arial
size=2>);
SetOption (<FONT
face=Arial color=#ff00ff size=2>"MaxOpenPositions"<FONT face=Arial
size=2>, 2<FONT face=Arial
size=2>);
SetOption (<FONT face=Arial
color=#ff00ff size=2>"AllowSameBarExit"<FONT face=Arial
size=2>,False<FONT face=Arial
size=2>);
SetOption (<FONT face=Arial
color=#ff00ff size=2>"ActivateStopsImmediately"<FONT face=Arial
size=2>,False);
PositionSize = <FONT face=Arial color=#ff00ff
size=2>10000;
BuyPrice = Close;
SellPrice = Close;<FONT face=Arial color=#0000ff
size=2>
SetTradeDelays ( <FONT color=#ff00ff
size=2>1,<FONT color=#ff00ff
size=2>1,<FONT face=Arial color=#ff00ff
size=2>0,<FONT face=Arial color=#ff00ff
size=2>0); <FONT face=Arial color=#008000
size=2>// buy, sell, short, cover<FONT
face=Arial color=#008000 size=2>
// BUY --------------------------------------------------------------
Buy = DateNum<FONT
face=Arial size=2>()>=<FONT face=Arial color=#ff00ff
size=2>931230<FONT face=Arial
size=2>;
// SELL --------------------------------------------------------------
//Sell=<FONT
color=#008000 size=2>True<FONT face=Arial color=#008000
size=2>;
Sell = False; <FONT face=Arial color=#0000ff
size=2>ApplyStop
(stopTypeNBar,stopModeBars<FONT
face=Arial size=2>,1<FONT face=Arial
size=2>);
Linda
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Sponsor
ADVERTISEMENT
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 the Yahoo! Terms of Service.
|