PureBytes Links
Trading Reference Links
|
Folks,
Can someone explain to me why the series '~xroc' is always zeros.
What this script does is to assemble all the 1 year rate of changes
of a watchlist into one variable called ROC260. The ROC data is
shifted forward so that the most recent times record the ROC data
(i.e. rather than near index 0 , it goes back from index BarCount-1).
I'd then like to determine the ROC's fitting into the 1%, 10%,
20%...90%, 99% ranks based on this data. This is what the
The variable 'count' stores the actual length of data from the Group
list being surveyed. This becomes the period for the Percentile
function.
The variable 'y' is the rank that is being sought. It records via
AddToComposite without a problem, even at index 0 (or the first
point). For some reason I can't record '~xroc' or it comes up with
zeroes via some other error.
Anyone have an idea of why I can't record ~xroc? I'm pulling my hair
out right now over this one. I don't want to go bald.
Thanks.
-ace
//-----------------------------------------------------------
// First seed the temporary variable for ROC(C,260) with the ROC's
// of all the stocks in in Group0
//-----------------------------------------------------------
list = CategoryGetSymbols( categoryGroup, 0 );
ROC260=Null;
count=0;
x=Null;
y=Null;
AddToComposite(y,"~yrank","C");
AddToComposite(x,"~xroc","C");
for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ )
{
ROC260[i+1]=LastValue(ROC(Nz(Foreign( sym, "Close" )),260));
count=count+1;
}
k=(BarCount-1-count);
roc260=Ref(ROC260,-k); // This is correct
AddToComposite(ROC260,"~roc260","C",1);
//-----------------------------------------------------------
// Loop i goes through percentile ranks in
// increments of 10 from 1 to 99
// x = the ROC(C,260) that corresponds to rank y
// y = % Rank in 10% Increments
//-----------------------------------------------------------
for( i = 0; i<=10; i++ )
{
y[i]=i*10;
if(i<1) y[i]=1;
if(i>9) y[i]=99;
x[i]=LastValue(Percentile( ROC260, count, y[i] ));
}
AddToComposite(y,"~yrank","C",1);
AddToComposite(x,"~xroc","C",1);
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
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/
|