Correlations Table

Hello!

Investigate correlations before you subscribe to several trading strategies!

/* 
 Disclaimer: 
 The systems used in this example were selected randomly.
 Data shown in this example can include errors.*/


Int64[] systems = new Int64[] {
    46106678, // Bob Dylan
    90325773, // Ascendatnt
    84690231, // Genefish Hong Kong
    92728998, // RSI Opportunistic
    90134941, // SPXTrends Futures
    77119743  // Mean Reversal ES Daily System 
};

H4 = "A correlation table with default values";
TABLE = GetCorrelationTable(systems);

H4 = "A correlation table of monthly returns using tradeMONSTER commissions plan";
TABLE = GetCorrelationTable(systems, TimeInterval.Month, "tm");



Enjoy!

5 Likes

Great work @BobSvan2 !

I have been praising the correlation factor when selecting strategy to many of our subscribers as it is the way professional portfolio are built.

Could you maybe add correlation to the overall Equity market as well? SPY usually works fine as a proxy. Like that it will be visible if a strategy is just alternative beta (high correlation to the overall market, positive or negative) or if there is real alpha in a strategy.

cheers

Fantastic Bob. Thanks.

thanks
could you please check my systems:
crazy options
crazy options 2016
9900 options

and check if they have any correlation and check it vs spy QQQ
thanks

Hello!

Done!

I added SP500 index data as a default parameter to the correlation table.

Example 1

Int64[] systems = new Int64[] {
    46106678, // Bob Dylan
    90325773  // Ascendatnt
};

H4 = "A correlation table with default values";
TABLE = GetCorrelationTable(systems);


Actually, the code
TABLE = GetCorrelationTable(systems);
is equivalent to
TABLE = GetCorrelationTable(systems, "SP500");

If you do not want SP500 in your table, use null as the second parameter:

TABLE = GetCorrelationTable(systems, null);


Example 2

If you want different symbol, use it as the second parameter:

Int64[] systems2 = new Int64[] {
       93301806, // CraZy Options
       98846459, // Crazy options 2016
       99198532 // 9900 Options
};
H4 = "Daily systems correlations including QQQ symbol ";
TABLE = GetCorrelationTable(systems2, "QQQ", TimeInterval.Day);


Example 3

The GetCorrelationTable function can be called this way now:

H4 = "A correlation table of monthly returns using tradeMONSTER commissions plan";
TABLE = GetCorrelationTable(systems, null, TimeInterval.Month, "tm");

H4 = "Include SP500 index to the above setup";
TABLE = GetCorrelationTable(systems, "SP500", TimeInterval.Month, "tm");

Enjoy!

Int64[] systems = new Int64[] {
    99007414, // Ascendant VX, aka Gemini VF1
    97232034, // Ascendant ES, aka Gemini 252
    100372333, // Ascendant TY Static
    98408819, //Vix Daytrader
    100722273 //VolatilityTrader
};

H4 = "A correlation table of short volatility strategies";
TABLE = GetCorrelationTable(systems, "XIV", TimeInterval.Day, "ib");

Thanks Bob!

Hi,

Can you please explain or point to some article/document that explains how this correlation is calculated?

If I download the equity data into a spreadsheet and apply the “correl” spreadsheet function, I get weird and impossible results. So I assume you do some data massaging in order to get the correct results. [I know what correlation is, I just need help with the data to use.]

Thanks!

I just tested it for Bob Dylan (46106678) and Ascendant (90325773) and Excel gives me the same results as C2Explorer.

Make sure you are using just common data (days) in Excel.

Bob Dylan started on 12/31/2009 and Ascendant on 10/20/2014.
So you need to use just common data from 10/20/2014 (until today) in Excel.
See “Common From” and “Common To” columns.

Hope it helps.

Hi, on some systems there is a big difference between the S&P/System correlation values calculated by Explorer and the S&P correlation value displayed on the system home page. For example, system 98408819 (VIX DayTrader) has a correlation of 0.43 to the S&P according to Explorer and only 0.058 on the system home page. Which is correct?

Just a comment: C2Explorer gives me a correlation 0.1626. Not 0.43.

More later…

Hi Bob,
I just paste this code into Explorer and select Run. There are no settings
so I don’t know how we could get different answers.
Int64[] systems = new Int64[] {
98128454, // GC Gold Glitters
98408819 // VIX DayTrader
};

H4 = “Building a Portfolio including the SPY ETF”;
TABLE = GetCorrelationTable(systems, “SPY”, TimeInterval.Month, “tm”);

Thanks, Chuck

The biggest difference is in TimeInterval.
You are using a monthly returns correlation, C2Explorer calculates a daily returns correlation and Collective2 uses intraday returns.

Minor differences are your “SPY” and “tm” parameters.

The default correlation is calculated by this command (just a systems list used):

TABLE = GetCorrelationTable(systems);

Default parameters are defined in the function interface like this:

GetCorrelationTable(
	IEnumerable<long> systemsIds,
	string symbol = "SP500",
	TimeInterval timeInterval = TimeInterval.Day,
	string commissionPLan = "default",
	EquityType equityType = EquityType.Rets
)
 

I added a new function:

TABLE = GetCorrelationTable(98408819);

We do not need to enter TWO systems now. This function accepts just one system. It simplifies a situation when we are interesting just in the strategy and SP500 correlation.

The data used for correlation with SP500 can be visualized this way:

TABLE = GetEquitiesSheet(systemId, TimeInterval.Day, EquityType.Rets | EquityType.SP500);

Example:


long systemId = 98408819;

TABLE = GetCorrelationTable(systemId);

H4 = "Correlation data";

TABLE = GetEquitiesSheet(systemId, TimeInterval.Day, EquityType.Rets | EquityType.SP500);


Enjoy!

Thanks for the explanation. My last comment would be: Whenever a piece of code is published in the forum, it would be great to label it as thoroughly as possible. In this case, I would suggest H4=“Daily Correlation data”. And, the C2 system page should label the correlation “Intraday Correlation S&P500”.

Bob, the original code you wrote no longer works. It returns an error message: 1:30:29 PM: *** Error: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Thanks

Thank you.

It works again now.

(It was a problem with the “SP500” symbol in the database.)

Hello Bob,

Would be possible build a function that calculates the intraday return correlation in order to get values that match what is listed on C2 ?

THX!

Hello,
unfortunately no.

C2Explorer uses end of day data.
We have no plan to use it with intraday data.

You should supply the list of systems that hit new 52-week highs for the leaderboard. It might actually be correct if it were based on simple end of day data. Whatever it’s doing now misses systems.

Another fast question:

How Can I perform a correlation analysis from a specific data start point? ( not since inception of the programs)

Let’s say I want the correlation analysis since Jan, 1 2017 How need to be changed the following script:

List systems = new List {

75800796,   // momentum   
100738045,  // Bismarck

};

H1 = “A correlation table with default values”;
HR();
TABLE = GetCorrelationTable(systems); // pls include S&P500 in the function if modified

Many Thanks!

Hello,

such feature is not there.

Perhaps you can calculate it yourself in Excel from data produced by this command:

TABLE = GetEquitiesSheet(systemId, TimeInterval.Day, EquityType.Rets | EquityType.SP500);

You can download data in the CSV format from the menu in the top-right corner of the table.

2 Likes