Hello,
For this to work, you would need to:
1. Set worst rank held to maximum value (5 in your
case)
2. Limit the number of open positions using custom backtester
depending on changing universe count.
To do that you need to iterate through signal list each bar
and set signal.symbol to -1 when signal
count exceeds the desired worst rank on bar-by-bar
basis.
3. To know how many symbols are in universe you may use
AddToComposite( 1, "~~~UNIVCOUNT", "C")
pre-scan (done only once) and refer later to it in custom
backtester code using Foreign().
Best regards, Tomasz Janeczko amibroker.com
----- Original Message -----
Sent: Thursday, March 08, 2007 1:01
AM
Subject: [amibroker] Converting
"WorstRankHeld" option to "WorstPercentileHeld"
When using ENABLEROTATIONALTRADING() I would like to
specify the "WorstRankHeld" option as a "WorstPercentileHeld".
The reason for this
is because when using a Watchlist such as the Fidelity Select Funds, the
number of funds changes from a quantity of 7 in the 1980s to a quantity of 42
today. Therefore, specifying an "ordinal" rank does not work the same over all
time periods (ie, WorstRankHeld = 5 may make perfect sense when the universe
contains 42 funds, but not when it holds just 7).
Conceptually, I know
that I would code it as:
SetOption("WorstRankHeld",
WorstPercentileHeld * UniverseCount);
However, I do not know how to calculate a
UniverseCount. My initial thought is to use the approach described
in the AddToComposite example in the User's Guide. Does anyone
know if this will work?
Additionally, the Back Tester would have to
recalculate the WorstRank Held option on each iteration for this to work.
Otherwise, it would just calculate it once and then use it far all dates.
Any help or insight would be appreciated.
__._,_.___
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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
For other support material please check also:
http://www.amibroker.com/support.html
SPONSORED LINKS
__,_._,___
|