#### CorrelationTable

Posted By billb 10 Years Ago

## CorrelationTable

 Message Posted Thursday March 06 2008 Calculates Correlations of each two-symbol combination in a WatchList.Generates a CSV File (C:\temp\cTable.csv) with the complete Correlation Matrix and a CSV file (C:\temp\cList.csv) with a sorted list of correlation coefficients.The CSV files are ready to read with EXCEL.Correlation is calculated from the bar-to-bar percentage change (Close-Close) of each instrument.Note: This "Trading System" contains a Shutdown() procedure only.The system can be downloaded by clicking here Posted Saturday October 25 2008 Thanks, this is useful. Posted Saturday October 25 2008 Just so you know who to give the credit to, this system was uploaded by DrKoch.  It doesn't show on the forum posts but you can see it in the uploaded trading section of the website and on the page for this system.Thanks,Daniel Posted Monday August 31 2009 Hi , first of all thank you very much Dr. Koch for this excelent code. And here comes my doubt´s :i´m in doubt about the Bars method used here, first i would like to know if it were used in NewBar method in simulation mode, if it would return only the bars existed so far ??? And if there is a way acessing bars outside the script - so i can make a DLL to make easier to use it. Inputing Symbols name , and start and end time ???               Thank´s in advance, Vitor . Posted Tuesday January 05 2010 This is very useful however I have just tried to run it in Ed2 and notice that InnerList is no longer supported...Just wondering what the changes should be for Ed2I suspect the old lines:         int cnt = bars.InnerList.Count;         double old = bars.InnerList[i-1].Close;         arr[i] = (bars.InnerList[i].Close / old - 1.0 ) * 100.0;should be:            int cnt = bars.Count;         double old = bars.LookBack(cnt-(i-1)).Close;         arr[i] = (bars.LookBack(cnt-i).Close / old - 1.0 ) * 100.0;Is this correct?thanks Edited: Tuesday January 05 2010 by smersh Posted Wednesday January 06 2010 InnerList has been renamed to Items.Thanks,Daniel Posted Wednesday January 06 2010 Great thanks.I have probs with bar synchronization (which is set to true). The code checks that the array pairs are same length but they are not. Are there any known bugs with the sync code?      int length = array1.GetUpperBound(0)-1;      if(length != array2.GetUpperBound(0)-1)      {         throw new Exception("length mismatch array1/array2");      }I have differences of 100 or so bars over 16000 15min bars.....Setting the Data Start Date to a few weeks back (900-ish bars) has no issues. (I will start another thread about this though) Edited: Wednesday January 06 2010 by smersh