PureBytes Links
Trading Reference Links
|
Anthony,
Based on dingo's suggestion, I used SetForeign to make the following
code working.
I would like to make two separate rankings for indiv. stocks and
indices in one exploration. Do you have any suggestions?
Thanks
Charles
// use this function to calculate self relative strength
// The funciton takes care of stocks with several quote length
// It returns the calculated relative strength array
function selfRelStrength (myArray)
{
sRelStren = IIf((IsNull(ROC(myArray, 260)) == False),
ROC(myArray, 260) +
ROC(myArray, 195) + ROC(myArray, 130) + 2 * ROC(myArray, 65),
IIf (
(IsNull(ROC(myArray, 195)) == False),
ROC
(myArray, 195) + 2 * ROC(myArray, 130) + 2 * ROC(myArray, 65),
2 *
ROC(myArray, 130) + 3 * ROC(myArray, 65) ));
return sRelStren;
}
//replace your watchlist number with 63
list = CategoryGetSymbols( categoryWatchlist, 63 );
// list = CategoryGetSymbols( categoryMarket , 0 ) +
CategoryGetSymbols( categoryMarket , 1 );
Count = 0;
rank = 0;
relval = 0;
// price change for the current symbol
OwnVal = selfRelStrength(C);
for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ )
{
SetForeign(sym);
relVal = Nz(IIf (IsIndex(), 0, selfRelStrength(C)) );
RestorePriceArrays();
n = Nz(IIf(relVal != 0, 1, 0)); //
count if there is a price change
// now, add up counts for all symbols with price change in
the specified period
Count = Count + n;
rank = IIf (relVal > OwnVal, rank + 1, rank);
}
rankPerc = int(100 * (Count - rank) / Count);
Filter = NOT (IsIndex());
if (Status("action") == 4) {
// code running in exploration
SetOption("nodefaultcolumns", True );
AddTextColumn(Name(),"Ticker");
AddColumn(Close,"Close", 1.2);
// AddColumn(Count,"count", 1.0);
AddColumn(rank,"rank#", 1.0);
AddColumn(Ownval,"Perf",1.2);
AddColumn(rankPerc,"rank%",1.0);
AddTextColumn(IndustryID(1),"Industry");
//AddColumn(BarCount, "Bars");
}
--- In amibroker@xxxxxxxxxxxxxxx, "Anthony Faragasso" <ajf1111@xxxx>
wrote:
> Charles,
>
> Can you give me an idea of the code you would be using....Then we
may be
> able to provide some help.
>
> Anthony
------------------------ Yahoo! Groups Sponsor --------------------~-->
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~->
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> 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/
|