Change Log
2015-09-08 - Added support to automatically label the plots.
2015-09-14 - Speed enhancements. Reduced 5 loops through the correlation period to 1 loop.
The atgPairsCorrelation indicator plots the correlated logarithmic returns of two data series.
Thanks to @Oysteryx for helping me make this indicator.
The inputs to the indicator are standard price series data. The indicator internally generates the logarithmic returns and calculates and plots the correlation between them. The value ranges between -1 and +1. A positive value means that the two data series are correlated ( moving together ) while a negative value means they're moving in opposite directions. The magnitude of the value expresses the fidelity of the correlation. A value of 1 is achieved if you compare an instrument with itself.
In addition to comparing pairs of data series, special functionality is included that allows you to compare with an interest rate spread.
A template to load the indicator as displayed in the screen shot is available on the support thread. The template displays the correlations of the following instruments:
ES -> ZN/ZT spread
ES -> 6J
ES -> CL
ES -> GC
ES -> ZB
ES -> 6A
ES -> 6E
It’s assumed that the primary data series loaded on the chart is one of the two data series to be correlated. The chart series is always compared with one other series that the indicator loads internally. You may of course use any data series you want on the chart and in the settings for the indicator to run correlation studies on pairs of interest to you.
To use the template (see support thread ) load it on a chart of the ES with at least 365 days of daily data. This template loads 7 instances of the atgPairsCorrelation into a single chart panel so that their plots are overlaid.
Here are some basic property settings to configure the indicator to compare the ES to the 6J contract ( USDJPY futures contract ):
You must maintain the property settings for each instance so that the contract months are current.
Spreads
For running a correlation on an interest rate spread you must enter the two instruments involved in the spread into SpreadLeg1 and SpreadLeg2. In addition you must enter weights for each leg of the spread. the CME publishes these weights here:
September 8th, 2015
Size: 3.71 KB
Downloaded: 1023 times
1649
timendaGain
This Tradestation Show Me tells you days that Congress is in session. Contains data from Dec 1997 - Oct 26, 2012.
You may find this useful for the stock market, since there have been a few studies that show correlation between when Congress is in session and stock market performance (Congress in session tends to mean stocks go down).
October 28th, 2012
Size: 222.72 KB
Downloaded: 117 times
1292
kevinkdog
This is the initial release of a NinjaTrader CORREL factor function. This function is similar to Excel's CORREL function but it allows you to find the correlation factor between two indicators as a function of time over a defined period.
February 26th, 2014
Size: 4.18 KB
Downloaded: 206 times
1526
NJAMC
R-Squared, Coefficient of Determination, the square of the Correlation Coefficient. This should return the same values as the standard supplied RSquared. Unfortunately both versions always iterate, so should probably be used with CalculateOnBarClose == true.
I believe my version to be slightly more CPU efficient, as it does not require a square root calculation used in the distribution version.
Version 1.0.
July 3rd, 2010
Size: 6.78 KB
Downloaded: 164 times
525
fluxsmith
Returns the Pearson product-moment correlation coefficient of the input series. This requires iteration, so should probably be used with CalculateOnBarClose == true.
Version 2 - Solves a /0 error, returns 0 if price is unchanged for all of the bars in the calculation.
February 16th, 2011
Size: 3.19 KB
Downloaded: 304 times
839
fluxsmith
Hi All,
At the end of the day, I print out the days chart and file it away. I was manually writing the day of the week on the chart, to later see if there was correlation in the DOW price action.
So to make life easier I thought I might as well print this on the chart automatically as each day starts. So on the first tick of the day, it prints the DOW to the left of the first bar.
The drawing of the DOW is actually in two parts.
1. Is the calculation of the DOW and placement into a string.
2. The actual printing of the string using a function.called "printtext"
The PrintText function has input parameters for the Day,time,position,text,size,color AND printing of the text in either a horizontal or vertical format.
The printtext function could be used for a multiple of things ie vertical printing text directly above a bar ie "Inside Bar" or whatever.
July 29th, 2011
Size: 12.04 KB
Downloaded: 199 times
968
NW27
Spread3 Price of 3 Instruments - For NinjaTrader 7 & higher
[Spread3] Calculates price of synthetic combination of 3 instruments Parameters are symbol of second & third instruments, and quantities of all instruments (positive for long, negative for short). PointValues from the instrument manager are optionally used as multipliers.
The primary chart instrument (BarsInProgress == 0) is the "clock" to which the other instruments are synchronized. You should make sure the most active instrument is the one selected as the primary instrument. The output of this indicator changes only when the OnBarUpdate is called for the primary instrument.
This indicator can be extended to 4 or more instruments. See my "Correlation" indicator for examples of how to do synchronized calculations with lookbacks
Kevin Doren 9/26/2010
2010.09.23 Spread6 Trader.Jon added support for N4 =4 decimal places && add to a total 6 supported symbols && reformated properties structures for readability
2010.09.27 updated to include changes from the new release of Spread3 .. exported as Spread6 from NT7b20
January 18th, 2017 02:56 PM AABid Very good at predicting reversals, especially in conjunction with a the unirenko chart. Wouldn't (couldn't?) trade with
out it.
January 10th, 2017 02:41 PM nubby Thanks..interesting CCI
August 26th, 2014 06:32 PM bobc635 Thank You very much!
April 21st, 2014 09:45 PM mikhersh Thank you Sir!
April 29th, 2013 09:44 AM TradingVictor Thank you very much.