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

[amibroker] Re: Ranking study



PureBytes Links

Trading Reference Links

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/