DinexSpace Correlation Matrix
- Indicators
-
Huu Tho Tran
DinexSpace - trading automation studio for MetaTrader 5.
We validate your trading idea with real costs in two stages before we code it. If the idea fails validation, we stop - you don't pay for the bot.
Live track record - Version: 1.0
Correlation Matrix shows how closely up to six symbols have moved together. It helps to avoid holding several positions that are really the same bet, and to see when a usual relationship between markets breaks down.
How it works
- The reference bars are the last N closed bars (60 by default) of the chosen timeframe (D1 by default) on the chart symbol.
- For each symbol the indicator finds the bar at the same time with iBarShift and takes its return, so symbols with different trading hours are compared on the same moments.
- It calculates the Pearson correlation for every pair: +1 = moved in the same direction in proportion, -1 = opposite directions, near 0 = no clear linear relation.
- Values at or beyond the highlight threshold (0.7 by default) are coloured: green for strong positive, aqua for strong negative.
- Only bars where both symbols have data are used for a pair. Pairs with fewer than five common bars show "n/a".
- The panel refreshes on a timer (every 30 seconds by default), which is enough for daily or hourly data and keeps the terminal light.
Inputs
- Symbols: up to six broker symbol names; Symbol 1 empty = the chart symbol. Unknown names are skipped with a message in the Experts log.
- Calculation: timeframe, number of returns, highlight threshold, refresh interval.
- Display: font size, panel corner.
Limits
- To read their history, the symbols are added to Market Watch.
- Correlation describes the past window only and can change quickly.
The indicator does not trade or give signals.
