tartigradia

Multi Delta-Agnostic Correlation Coefficient (tartigradia)

tartigradia Mis à jour   
Display three DACC plots simultaneously, to visualize both directional (up on top, down at bottom) and adirectional DACC (in the middle) simultaneously.
Delta Agnostic Correlation calculates a correlation between two symbols based only on the sign of their changes using a Sign Test (en.m.wikipedia.org/wiki/Sign_test), regardless of the amplitude of price change. Compared to a standard Pearson correlation (quantitative test), Sign Test correlations (discrete test) are highly sensitive to directional change with 0 lag, at the expense of lacking sensitivity to quantity correlation (ie, it does not matter if changes are big or small).

Hence, this Delta-Agnostic Correlation Coefficient (DCC or DACC) indicator is better used to detect early changes in correlations, and then confirmation with a typical Pearson correlation or a non-parametric Spearman test or Mutual Information (all three are quantitative tests, hence accounting for quantity and not just direction) can allow to be more sensitive to quantities too and hence be a robust combination to demonstrate strong correlations both in direction and amplitude.

Adequate statistical significance testing, using a two-sided binomial statistical test, is also implemented. Note however that one assumption of the sign test may here be violated: independence of observations for each symbol. If you assume the market is not acting on a random walk, then there is a temporal autocorrelation, and this biases the sign test. However, in practice, the test works well enough.

The directional variants of the test allow to test the correlation hypothesis only if the index symbol goes into one direction. For example, if we suspect that the index symbol is correlated with the current symbol but only when the index symbol is bullish, we can select "Up" to test this hypothesis. Note that given the specificities of how directional and adirectional tests differ in how they work, the default fill is different: zero-value fill for adirectional test to simulate how price action tend to lose momentum during market close periods, previous DCC_MA (= no change in DCC value) during both market close periods and when the direction is opposite for the directional variants of the test, so that while the market is moving opposite, we don't lose the statistical significance built up to now, otherwise it would be nonsensical (for the directional tests).

For more information on the theory behind, see the original DACC indicator, which is the same script but with only one plot:
Notes de version:
Here is an example of how to read this indicator:


This shows the 4H price action of BTCUSD during the first two weeks of November 2022, when the FTX insolvency caused crash happened, which was the 2nd biggest crypto exchange at the time, just after Binance. This was followed two days after by an impressive relief pump following favorable CPI readings.

So the question we may ask is: how is BTCUSD correlated with DXY, as a proxy of the monetary policy that the FED is directing?

A first, common approach is to look at the correlation between BTCUSD and DXY. The middle plot, "adirectional", shows exactly that. We can see that most often, both assets are anticorrelated, which means that when DXY goes up, BTCUSD goes down, and inversely. But this does not always applies, although it happens more often than not.

So then we can ask: what conditions makes BTCUSD be more correlated with DXY? One hypothesis may be that since we are in a bear market, and especially since there is an ongoing crash due to a black swan event (FTX sudden insolvency), as the adage goes, bad news make things worse, and good news only reduces some of the sell pressure. In a bull market, it's usually the opposite: any good news will pump the market, and any bad news will only slow it down a bit the buy pressure usually.

So we can form the hypothesis that maybe the correlation works better when DXY goes up, which means that it increases selling pressure on BTCUSD. We will name this the UP correlation, when DXY (the index symbol) goes up/is bullish. Whereas the opposite hypothesis, which is that when DXY goes down, there is less selling pressure on BTCUSD and hence BTCUSD goes up, is the DOWN correlation.

In the example above, the top plot is the UP correlation, whereas the bottom plot is the DOWN correlation. We can clearly see that during the FTX caused market crash, our hypothesis was mostly true: the UP correlation kept being maintained at a high anticorrelation value, whereas the DOWN correlation was low and unsignificant.

In practice, this means that during the crash, we could have played DXY rebounds expecting BTCUSD to go down, but everytime DXY was going down, it would have been a signal to exit positions, but NOT long BTCUSD, as there was no correlation of increases of BTCUSD when DXY was going down, BTCUSD just kept doing whatever it wanted (ie, following the emotions of the fallout of the FTX black swan event).

I hope this example gave you a better idea of how this indicator can be used in practice, don't forget there are always multiple ways to use an indicator, and these do not replace the need to be an experienced trader especially skilled in risk management to be profitable. Enjoy!
Script open-source

Dans le véritable esprit de TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par le règlement. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.

Vous voulez utiliser ce script sur un graphique ?