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

[amibroker] Re: finding pairs



PureBytes Links

Trading Reference Links



The conflict in what you guys are describing is that exploration runs once per symbol. In other words, you can have at most one row per symbol in the output.

For example, you cannot have the following because it would assume more than a single row per symbol:

XYZ     ABC     0.867
XYZ     JKI     0.932
...

If you want to see the correlation between one symbol and every other symbol in the watchlist, then you must use a table format as pointed out by Herman. You can just zero out the columns that don't meet your minimum criteria, and even use a different color for those uninteresting cells.

If you only want to see predetermined pairs, then write your code to specifically check for those combinations.

periods = 252;
correlated =
0
;
other =
""
;

if (Name() == "MSFT"
) {
   other =
"AAPL"
;
   correlated =
Correlation(Close, Foreign(other, "C"
), periods);
}
else if (Name() == "ORCL"
) {
   other =
"IBM"
;
   correlated =
Correlation(Close, Foreign(other, "C"
), periods);
}

Filter = correlated > 0.8
;

SetOption("NoDefaultColumns", true
);
AddTextColumn(Name(), "Ticker 1"
);
AddTextColumn(other, "Ticker 2"
);
AddColumn(correlated, "Correlation");

Mike


--- In amibroker@xxxxxxxxxxxxxxx, "ezbentley" <ezbentley@xxx> wrote:
>
> Hi Herman,
>
> I am aware of the correlation table. However, that table will show the correlation among ALL stocks.
>
> What I am trying to accomplish is something like this(pseudo code only to illustrated my intent):
>
> Correl = Correlation(StockA, StockB, 250);
> Filter = Correl > 0.8;
> AddColumn(StockA, "Ticker1");
> AddColumn(StockB, "Ticker2");
> AddColumn(Correl, "Correlation");
>
> And the output of the Exploration should look something like:
>
> Ticker1 Ticker2 Correlation
> XYZ ABC 0.867
> DFG JKI 0.932
> ..........
>
> In other words, I want to filter for high correlation pairs and output them in a tabular form as supposed to a matrix.
>
> Any help will be greatly appreciated,
>



__._,_.___


**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___