Here's a correlation indicator with a configurable window setting.
The indicator is referencing the open source mathlib found on this site:
Not sure it's a good idea to distribute everything as one pack from a licensing perspective so the install is a bit ugly as it requires some manual copying of files.
Instructions:
1. Download the C sharp pack from http://www.alglib.net/ (free for personal use as I understand it)
2. Unzip and dig out the following files and copy them into NinjaTrader7\bin\Custom\Indicator\
(you could also build a dll that you can reference, I did this but there were some problems with compiling it in NT7 so this is a bit of a dirty workaround...):
ap.cs
correlationtests.cs
conv.cs
corr.cs
correlation.cs
fft.cs
ftbase.cs
gammafunc.cs
ibetaf.cs
normaldistr.cs
studenttdistr.cs
3. Copy the attached indicator file into the same dir.
4. Open KJCorrelation through: Tools=>Edit NinjaScript =>
5. Compile
6. Add the indicator on a chart with a contract, configure by setting SymbolA to whatever contract you want compare the key contract with and the correlation window.
That's it. Again, sorry it's a bit of a hack... It should work though.
Comment