<\/a><\/p>\nFor the X-Y axis to have the same order, you should sort your Watchlist alphabetically in your workspace (right-click on the Watchlist and click Sort Alphabetically). To run the exploration below, copy the code to the AA editor, set the AA Filter for your Watchlist, select your Watchlist in the AA Param window, and click Explore.<\/p>\n
WLNum = Param(\"WatchList Number\",0,0,64,1);
\nCorrPd = Param(\"Correlation Period\",8,1,30,1);
\nlist = GetCategorySymbols( categoryWatchlist, WLNum);
\nSetOption(\"NoDefaultColumns\",True);
\nFilter = Status(\"LastBarInTest\");
\nSetSortColumns( 1 );
\nAddTextColumn(Name(),\"Correlation\",1.0);
\nTicker1= Name();
\nfor( Col=0; (Ticker2=StrExtract( List, Col))!= \"\"; Col++)
\n{
\nVar2 = Foreign(Ticker2,\"C\");
\nCorr = Correlation( C, Var2, CorrPd);
\nColor = IIf(Corr>0, colorBrightGreen, IIf(Corr<0, colorRed,colorWhite));
\nColor = IIf(Ticker1==Ticker2, 1, Color);
\nAddColumn( Corr, Ticker2, 1.3, 1, Color);
\n}<\/code><\/p>\nEdited by Al Venosa<\/p>\n","protected":false},"excerpt":{"rendered":"
Note: There may be a problem with this code since the possibility of padded data occuring within the correlation period wasn’t considered. This code is under review right now. [Herman] When experimenting with or looking for trading ideas, you may want to analyze the relationships or correlation between any two tickers. For example, you could […]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[66],"tags":[],"_links":{"self":[{"href":"http:\/\/www.amibroker.org\/editable_userkb\/wp-json\/wp\/v2\/posts\/43"}],"collection":[{"href":"http:\/\/www.amibroker.org\/editable_userkb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.amibroker.org\/editable_userkb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.amibroker.org\/editable_userkb\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.amibroker.org\/editable_userkb\/wp-json\/wp\/v2\/comments?post=43"}],"version-history":[{"count":0,"href":"http:\/\/www.amibroker.org\/editable_userkb\/wp-json\/wp\/v2\/posts\/43\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.amibroker.org\/editable_userkb\/wp-json\/wp\/v2\/media?parent=43"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.amibroker.org\/editable_userkb\/wp-json\/wp\/v2\/categories?post=43"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.amibroker.org\/editable_userkb\/wp-json\/wp\/v2\/tags?post=43"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}