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

Re: [amibroker] Question on RS - one more exploration



PureBytes Links

Trading Reference Links

This is a useful scan that was in the AFL library
 
JAson 
 

EnableRotationalTrading();

SetOption("WorstRankHeld", 5);

PositionSize = -100;

PositionScore = 0;

WatchlistNum = 1;

Filter=1;

NumColumns=0;

function CalculatePosition(st, Lt1, Lt2, Lt3, Lt4, Lt5, Lt6)

{

score=0;

if(st > Lt1) score++;

if(st > Lt2) score++;

if(st > Lt3) score++;

if(st > Lt4) score++;

if(st > Lt5) score++;

if(st > Lt6) score++;

return score;

}

 

// walk through the watchlist grabbing all the symbols to calculate RS vsourse

List = CategoryGetSymbols(categoryWatchlist, WatchlistNum);

for(i=0; (sym = StrExtract(List, i)) != "";i++)

{

if(sym != Name())

{

f = RelStrength(sym);

st3 = EMA(f, 3);

st5 = EMA(f, 5);

st8 = EMA(f, 8);

st12 = EMA(f, 12);

st15 = EMA(f, 15);

Lt30 = EMA(f, 30);

Lt35 = EMA(f, 35);

Lt40 = EMA(f, 40);

Lt45 = EMA(f, 45);

Lt50 = EMA(f, 50);

Lt60 = EMA(f, 60);

z=BarCount - 1;

// uncomment the following if you want to do some backtesting or if you likewaiting around

// a long time for the exploration to complete

//for(z=0;z < BarCount;z++)

{

PositionScore[z] = PositionScore[z] + CalculatePosition(st3[z], Lt30[z],

Lt35[z], Lt40[z], Lt45[z], Lt50[z], Lt60[z]);

PositionScore[z] = PositionScore[z] + CalculatePosition(st5[z], Lt30[z],

Lt35[z], Lt40[z], Lt45[z], Lt50[z], Lt60[z]);

PositionScore[z] = PositionScore[z] + CalculatePosition(st8[z], Lt30[z],

Lt35[z], Lt40[z], Lt45[z], Lt50[z], Lt60[z]);

PositionScore[z] = PositionScore[z] + CalculatePosition(st12[z], Lt30[z],

Lt35[z], Lt40[z], Lt45[z], Lt50[z], Lt60[z]);

PositionScore[z] = PositionScore[z] + CalculatePosition(st15[z], Lt30[z],

Lt35[z], Lt40[z], Lt45[z], Lt50[z], Lt60[z]);

}

}

}

AddTextColumn(FullName(), "Name");

AddColumn(PositionScore[BarCount - 1], "RS");


_______________________________________________________________
Quad Rate Serial Abby <quad_pumped_abby@xxxxxxxxx> wrote:
I would like to do an exploration for the change in RS of a sector
over various periods, say one week, two weeks, etc.  I extracted the
RS of the sector versus the S&P Equal Weight Index using:

Strength = RelStrength ( "SPEW-X", fixup = 1 );

Then I found the change over the time periods in question.

Of course, when you look at a plot of the RS for a symbol or sector it
appears the numerical value of the RS is directly correlated to the
price of the underlying.  Thus, the numerical change in RS would be
meaningless against a different priced sector. 

I thought the simple solution was to divide the RS value by the
closing price, thus normalizing the results.  But this caused the RS
charts and values to be identical for every sector. 

Is what I'm trying to do an impossibility with Amibroker or is my
approach all wrong?  Any help would be appreciated.

Thanks,

Bret




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 other support material please check also:
http://www.amibroker.com/support.html



__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

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 other support material please check also:
http://www.amibroker.com/support.html





YAHOO! GROUPS LINKS