[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Ranking study



PureBytes Links

Trading Reference Links

--- In amibroker@xxxxxxxxxxxxxxx, Eric Leake <eleake@xxxx> wrote:

Thanks again for the assistance Andrew. After looking at this, I 
am wondering if it is really accomplishing what I am trying to do. 

Has anyone here discussed Jay Kaeppel's Relative Strength strategy? 
It is a fairly simple in concept, but I am having a difficult time 
coding it. His strategy is this:

-Rank the securities by their 40 week Relative Strength. (ROC)
-From the top 8, select five funds for 20% positions each.
-If there are less than 5 funds in the top 8 that are above their 
exit, hold cash for that portion.
-Exit if the weekly low is more than $.02 below its 28week EMA.
-If a fund falls out of the top 8, then replace it with the next 
candidate.

The code we have so far is only accomplishing half of this strategy-
basically screening securities that are above their EMA, and sorting 
them by their RS. 

What approach do I need to take to make sure that when a security 
falls out of the top x%, or top 8, they are sold and replaced? 

Thanks for the help!

-Eric.


--- In amibroker@xxxxxxxxxxxxxxx, "Andrew" <a.perrin@xxxx> wrote:
> Eric
> lets step through code first.  The line >Avg = EMA(Close, 28); 
needs 
> to be modified as Avg is a predefined identifier. It denotes the 
> average price -(High+Low+Close)/3 - so called "typical price". 
> The lines 
> > NumColumns = 3;
> > Column0Name = "RS Index";
> > Column0     = RS;
> can be replaced with AddColumn(rs,"RS Index"); 
> This is just easier.
> To Rank the securities you have to assign a positionScore to each 
> security, you have calculated this in your RS array.  To buy 5 
> positions, set PositionSize to -20, this represents 20% of your 
> capital to each position.  Note - set Allow Position Size 
Shrinking 
> in AA settings otherwise you will only end up with 4 open 
positions 
> (each position is 20% + Commission, so available capital for 5th 
> position is slightly less than 20%).
> For realistic EOD backtesting results, set tradedelays to 1, set 
> commissions large enough to cover both commission + slippage. (I 
use 
> 1% - large yes but if a system can't survive this it is not going 
to 
> interest me anyway).
> So now our AFL looks something like 
> 
> RS = ROC(Close, 120);
> Av = EMA(Close, 28);
> Exit = Close < Av;
> PositionScore = rs;
> Buy = Close > Av;
> Sell = exit;
> PositionSize = -20;
> SetTradeDelays(1,1,1,1);
> 
> Filter = GroupID() == 0;
> AddColumn(rs,"rel Str");
> 
> The filter setting is only used in explores, so for backtests 
define 
> the Apply To filter to select Group 0 or bactest on all securities 
> and Substitute  Buy = Close > Av AND GroupID() == 0;  (first 
option 
> is probably faster.
> Hope this helps
> Andrew 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "ericleake" <eleake@xxxx> wrote:
> > Making my first attempt at a very simple Relative Strength scan. 
> > Using the ROC function, I'm able to create a RS number. I'm also 
> > able to code a simple moving average qualifier for a buy signal, 
> as 
> > well as an exit. 
> > 
> > What approach should I use then to rank the securities by their 
> new 
> > RS number, and buy say the top 5? Would the new Percentile 
> function 
> > be the way to handle this? Here is what I have so far:
> > 
> > Filter = GroupID() == 0;
> > 
> > RS = ROC(Close, 120);
> > Avg = EMA(Close, 28);
> > 
> > Exit = Close < Avg;
> > 
> > 
> > 
> > NumColumns = 3;
> > Column0Name = "RS Index";
> > Column0     = RS;
> > 
> > Any help would be appreciated!
> > 
> > -Eric.


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/