PureBytes Links
Trading Reference Links
|
thank you very much
graham,
i just did a quick scan, and your
code does exactly what i was looking for. will have a look at the code after the
weekend.
dirk
<BLOCKQUOTE
>
----- Original Message -----
<DIV
>From:
<A title=gkavanagh@xxxxxxxxxxxxx
href="">Graham
To: <A title=amibroker@xxxxxxxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Thursday, December 11, 2003 12:59
PM
Subject: RE: [amibroker] one-stock
exploration with various rows
I am not certain this will work properly as
I cannot test it out. But I think it is what you are wanting. Just set your
n=2 in the AA filter window
I have also modified your code to remove
redundent loops and statements, hope I did not mess it
up.
// Correlation Analysis for Single Stock<FONT
size=2>
Buy<FONT
size=2>=Sell<FONT
face=Arial>=<FONT color=#ff0000
size=2>Short=<FONT
color=#ff0000 size=2>Cover<FONT
size=2>=0<FONT
size=2>;
LastBarInTest = <FONT color=#0000ff
size=2>LastValue<FONT
size=2>(ValueWhen<FONT
face=Arial>(<FONT color=#0000ff
size=2>Status(<FONT
color=#8b0000 size=2>"LastBarInTest"<FONT
size=2>),BarIndex<FONT
size=2>()));
Filter =
Status<FONT
face=Arial>(<FONT color=#8b0000
size=2>"LastBarInTest"<FONT
face=Arial>);
list = <FONT
face=Arial>GetCategorySymbols(
categoryWatchlist<FONT
face=Arial>, <FONT color=#ff00ff
size=2>3 );
timeshort=<FONT color=#ff00ff
size=2>8<FONT
face=Arial>;
timemed=<FONT
face=Arial>63;
timelong=<FONT
face=Arial>252<FONT
face=Arial>;
for(
NumTickers=0<FONT
face=Arial>; NumTickers < <FONT color=#ff00ff
size=2>100 <FONT
color=#ff0000 size=2>AND
StrExtract<FONT
face=Arial>( list, NumTickers ) != <FONT color=#8b0000
size=2>""; NumTickers++
);
AddTextColumn<FONT
size=2>("Corr.
short",<FONT
color=#8b0000 size=2>"Filter"<FONT
size=2>,1.0<FONT
size=2>);
bar = <FONT
face=Arial>BarCount -
1<FONT
size=2> - BarIndex<FONT
size=2>();
A1 = <FONT
face=Arial>ValueWhen( bar,
BarCount<FONT
face=Arial>-<FONT color=#ff00ff
size=2>1 );
A2 = <FONT
face=Arial>ValueWhen( bar,
BarCount<FONT
face=Arial>-<FONT color=#ff00ff
size=2>2
);
Filter =
BarIndex<FONT
face=Arial>()==A1 <FONT color=#ff0000
size=2>OR <FONT
color=#0000ff size=2>BarIndex<FONT
face=Arial>()==A2;
for(
Col=0<FONT
face=Arial>; Col<NumTickers; Col++)
{
Ticker1 = <FONT color=#0000ff
size=2>Name<FONT
face=Arial>();
Ticker2 = <FONT color=#0000ff
size=2>StrExtract<FONT
face=Arial>( list, Col);
Var1 = <FONT
face=Arial>Foreign<FONT
size=2>(Ticker1,<FONT color=#8b0000
size=2>"C");
Var2 = <FONT
face=Arial>Foreign<FONT
size=2>(Ticker2,<FONT color=#8b0000
size=2>"C");
Corrshort = <FONT color=#0000ff
size=2>Correlation<FONT
face=Arial>( Var1, Var2, timeshort );
Corrmed = <FONT color=#0000ff
size=2>Correlation<FONT
face=Arial>( Var1, Var2, timemed );
Color = <FONT
face=Arial>IIf(Corrmed
==1<FONT
face=Arial> <FONT color=#ff0000
size=2>OR Corrshort
==1<FONT
face=Arial>,<FONT color=#ff0000
size=2>colorBlack<FONT
size=2>,IIf<FONT
face=Arial>(Corrmed <-<FONT color=#ff00ff
size=2>0.8 <FONT
color=#ff0000 size=2>OR
Corrshort <-0.8<FONT
face=Arial>,<FONT color=#ff0000
size=2>colorRed<FONT
face=Arial>,
IIf<FONT
size=2>(Corrmed <-<FONT color=#ff00ff
size=2>0.5 <FONT
color=#ff0000 size=2>OR
Corrshort <-0.5<FONT
face=Arial>,<FONT color=#ff0000
size=2>colorOrange<FONT
size=2>,IIf<FONT
face=Arial>(Corrmed <-<FONT color=#ff00ff
size=2>0.2 <FONT
color=#ff0000 size=2>OR
Corrshort <-0.2<FONT
face=Arial>,<FONT color=#ff0000
size=2>colorLightOrange<FONT
face=Arial>,
IIf<FONT
size=2>(Corrmed <<FONT color=#ff00ff
size=2>0.2 <FONT
color=#ff0000 size=2>OR
Corrshort <0.2<FONT
face=Arial>,<FONT color=#ff0000
size=2>colorCustom9<FONT
size=2>,IIf<FONT
face=Arial>(Corrmed <<FONT color=#ff00ff
size=2>0.5 <FONT
color=#ff0000 size=2>OR
Corrshort <0.5<FONT
face=Arial>,<FONT color=#ff0000
size=2>colorAqua<FONT
face=Arial>,
IIf<FONT
size=2>(Corrmed <<FONT color=#ff00ff
size=2>0.8 <FONT
color=#ff0000 size=2>OR
Corrshort <0.8<FONT
face=Arial>,<FONT color=#ff0000
size=2>colorBrightGreen<FONT
size=2>,colorGreen<FONT
size=2>)))))));
x[<FONT
face=Arial>BarCount<FONT
size=2>-2<FONT
face=Arial>] = <FONT color=#0000ff
size=2>LastValue( Corrshort
);
x[<FONT
face=Arial>BarCount<FONT
size=2>-1<FONT
face=Arial>] = <FONT color=#0000ff
size=2>LastValue( Corrmed
);
AddColumn(
x , Ticker2, 1.3<FONT
face=Arial>, <FONT color=#ff00ff
size=2>1, Color);
}
Cheers,Graham<A
href="">http://groups.msn.com/asxsharetrading<A
href="">http://groups.msn.com/fmsaustralia
Yahoo! Groups Sponsor
ADVERTISEMENT
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 the Yahoo! Terms of Service.
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
|