PureBytes Links
Trading Reference Links
|
Hello:
I have been trying to figure out how to write an AFL to backtest a method that (1) selects the strongest sector based on RS or a similar metric and then (2) select the strongest stock within the strongest sector.
I think sector proxies may be created using addtocomposite(). However, I'm not sure how to then rank just the sectors. Worse, once this is done I have no idea how to accomplish step (2), picking the strongest stock within that sector, using AFL.
pseudo code might look something like:
//select the strongest sector
for i = 1 to N_Sector
if sector is strongest over past week then
strongest_sector = sector(i)
next i
//select the strongest stock within strongest sector
for j = 1 to N_Stocks_in_Sector(i)
if stock is strongest over past week then
strongest_stock = stock(j)
next j
buy strongest stock in strongest sector (stock(j))
Is it possible to write these types of loops in AFL (for backtesting)? If so, is it possible to have logic based on a sector attribute?
Any help or example code to point me in the right direction would be greatly appreciated.
Many thanks!
Greg
------------------------------------
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> 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/
|