Cross Correlation [Kioseff Trading]Hello!
This script "Cross Correlation" calculates up to ~10,000 lag-symbol pair cross correlation values simultaneously!
Cross correlation calculation for 20 symbols simultaneously
+/- Lag Range is theoretically infinite (configurable min/max)
Practically, calculate up to 10000 lag-symbol pairs
Results can be sorted by greatest absolute difference or greatest sum
Ability to "isolate" the symbol on your chart and check for cross correlation against a list of symbols
Script defaults to stock pairs when on a stock, Forex pairs when on a Forex pair, crypto when on a crypto coin, futures when on a futures contract.
A custom symbol list can be used for cross correlation checking
Can check any number of available historical data points for cross correlation
Practical Assessment
Ideally, we can calculate cross correlation to determine if, in a list of assets, any of the assets frequently lead or lag one another.
Example
Say we are comparing the log returns for the previous 10 days for SPY and XLU.
*A single time-interval corresponds to the timeframe of your chart i.e. 1-minute chart = 1-minute time interval. We're using days for this example.
(Example Results)
A lag value (k) +/-3 is used.
The cross correlation (normalized) for k = +3 is -0.787
The cross correlation (normalized) for k = -3 is 0.216
A positive "k" value indicates the correlation when Asset A (SPY) leads Asset B (XLU)
A negative "k" value indicates the correlation when Asset B (XLU) leads Asset A (SPY)
A normalized cross correlation of -0.787 for k = +3 indicates an "adequately strong" negative relationship when SPY leads XLU by 3 days.
When SPY increases or decreases - XLU frequently moves in the opposite direction 3 days later.
A cross correlation value of 0.216 at k = −3 indicates a "weak" positive correlation when XLU leads SPY by 3 days.
There's a slight tendency for SPY to move in the same direction as XLU 3 days later.
After the cross-correlation score is normalized it will fall between -1 and 1.
A cross-correlation score of 1 indicates a perfect directional relationship between asset A and asset B at the corresponding lag (k).
A cross correlation of -1 indicates a perfect inverse relationship between asset A and asset B at the corresponding lag (k).
A cross correlation of 0 indicates no correlation at the corresponding lag (k).
The image above shows the primary usage for the script!
The image above further explains the data points located in the table!
The image above shows the script "isolating" the symbol on my chart and checking the cross correlation between the symbol and a list of symbols!
Wrapping Up
With this information, hopefully you can find some meaningful lead-lag relationships amongst assets!
Thank you for checking this out (:
Correlations
CE - 42MACRO Equity Factor Table This is Part 1 of 2 from the 42MACRO Recreation Series
The CE - 42MACRO Equity Factor Table is a whole toolbox packaged in a single indicator.
It aims to provide a probabilistic insight into the market realized GRID Macro Regime, use a multiplex of important Assets and Indices to form a high probability Implied Correlation expectation and allows to derive extra market insights by showing the most important aggregates and their performance over multiple timeframes... and what that might mean for the whole market direction, as well as the underlying asset.
WARNING
By the nature of the macro regimes, the outcomes are more accurate over longer Chart Timeframes (Week to Months).
However, it is also a valuable tool to form a proper,
market realized, short to medium term bias.
NOTE
This Indicator is intended to be used alongside the 2nd part "CE - 42MACRO Yield and Macro"
for a more wholistic approach and higher accuracy.
Due to coding limitations they can not be merged into one Indicator.
Methodology:
The Equity Factor Table tracks specifically chosen Assets to identify their performance and add the combined performances together to visualize 42MACRO's GRID Equity Model.
For this it uses the below Assets, with more to come:
Dividend Compounders ( AMEX:SPHD )
Mid Caps ( AMEX:VO )
Emerging Markets ( AMEX:EEM )
Small Caps ( AMEX:IWM )
Mega Cap Growth ( NASDAQ:QQQ )
Brazil ( AMEX:EWZ )
United Kingdom ( AMEX:EWU )
Growth ( AMEX:IWF )
United States ( AMEX:SPY )
Japan ( AMEX:DXJ )
Momentum ( AMEX:MTUM )
China ( AMEX:FXI )
Low Beta ( AMEX:SPLV )
International ex-US ( NASDAQ:ACWX )
India ( AMEX:INDA )
Eurozone ( AMEX:EZU )
Quality ( AMEX:QUAL )
Size ( AMEX:OEF )
Functionalities:
1. Correlations
Takes a measure of Cross Market Correlations
2. Implied Trend
Calculates the trend for each Asset and uses the Correlation to obtain the Implied Trend for the underlying Asset
There are multiple functionalities to enhance Signal Speed and precision...
Reading a signal only over a certain threshold, otherwise being colored in gray to signal noise or unclear market behavior
Normalization of Signal
Double Normalization of Signal for more Speed... ideal for the Crypto Market
Using an additional Hull Moving Average to enhance Signal Speed
Additional simple Background coloring to get a Signal from the HMA
Barcoloring based on the Implied Correlation
3. Equity Factor Table
Shows market realized Asset performance
Provides the approximate realized GRID market regimes
Informs about "Risk ON" and "Risk OFF" market states
Now into the juicy stuff...
Visuals:
There is a variety of options to change visual settings of what is plotted and where
+ additional considerations.
Everything that is relevant in the underlying logic which can improve comprehension can be visualized with these options.
More to come
Market Correlation:
The Market Correlation Table takes the Correlation of all the Assets to the Asset on the Chart,
it furthermore uses the Normalized KAMA Oscillator by IkkeOmar to analyse the current trend of every single Asset.
(To enhance the Signal you can apply the mentioned Indicator on the relevant Assets to find your target Asset movements that you intend to capture...
and then change the length of the Indicator in here)
It then Implies a Correlation based on the Trend and the Correlation to give a probabilistically adjusted expectation for the future Chart Asset Movement.
This is strengthened by taking the average of all Implied Trends.
Thus the Correlation Table provides valuable insights about probabilistically likely Movement of the Asset over the defined time duration,
providing alpha for Traders and Investors alike.
Equity Factors:
The table provides valuable information about the current market environment (whether it's risk on or risk off),
the rough GRID models from 42MACRO and the actual market performance.
This allows you to obtain a deeper understanding of how the market works and makes it simple to identify the actual market direction,
makes it possible to derive overall market Health and shows market strength or weakness.
Utility:
The Equity Factor Table is divided in 4 Sections which are the GRID regimes:
Economic Growth:
Goldilocks
Reflation
Economic Contraction:
Inflation
Deflation
Top 5 Equity Factors:
Are the values green for a specific Column?
If so then the market reflects the corresponding GRID behavior.
Bottom 5 Equity Factors:
Are the values red for a specific Column?
If so then the market reflects the corresponding GRID behavior.
So if we have Goldilocks as current regime we would see green values in the Top 5 Goldilocks Cells and red values in the Bottom 5 Goldilocks Cells.
You will find that Reflation will look similar, as it is also a sign of Economic Growth.
Same is the case for the two Contraction regimes.
This whole Indicator, as well as the second part, is based to a majority on 42MACRO's models.
I only brought them into TV and added things on top of it.
If you have questions or need a more in-depth guide DM me.
Will make a guide to all functionalities if necessity becomes apparent.
GM
Correlation TrackerCorrelation Tracker Indicator
The Correlation Tracker indicator calculates and visualizes the correlation between two symbols on a chart. It helps traders and investors understand the relationship and strength of correlation between the selected symbol and another symbol of their choice.
Indicator Features:
- Correlation Calculation: The indicator calculates the correlation between two symbols based on the provided lookback period.
- Correlation Scale: The correlation value is normalized to a scale ranging from 0 to 1 for easy interpretation.
- Table Display: A table is displayed on the chart showing the correlation value and a descriptive label indicating the strength of the correlation.
- Customization Options: Users can customize the text color, table background color, and choose whether to display the Pearson correlation value.
- The Correlation Tracker indicator utilizes a logarithmic scale calculation, making it particularly suitable for longer timeframes such as weekly charts, thereby providing a more accurate and balanced measure of correlations across a wide range of values.
How to Use:
1. Select the symbol for which you want to track the correlation (default symbol is "SPX").
2. Adjust the lookback period to define the historical data range for correlation calculation.
3. Customize the text color and table background color according to your preference.
4. Choose whether to display the Pearson correlation value or a descriptive label for correlation strength.
5. Observe the correlation line on the chart, which changes color based on the strength of the correlation.
6. Refer to the correlation table for the exact correlation value or the descriptive label indicating the correlation strength.
Note: The indicator can be applied to any time frame chart and is not limited to logarithmic scale.
Average sector correlations to SPYHello Traders!
This is our latest addition to MFR TradingView account: Average sector correlations to SPY.
The Average Sector Correlation indicator is a powerful tool designed to give insights into the interconnectedness of different SPY sectors in relation to the SPY itself. As an introduction, know that this indicator presents the average correlation of all SPY sectors, serving as a barometer for overall market cohesion and relative performance.
At Myfractalrange, we monitor correlations extensively as we know they serve as warning for reversals, bullish rallies, bear market allies, etc.
Before going into how subscribers can use this script, let't have a look at the different data points:
In this script, we are calculating the average sector correlations to the SPY (S&P 500 ETF).
The following data points are used for the calculation:
- XLK: Technology Select Sector SPDR Fund
- XLE: Energy Select Sector SPDR Fund
- XLF: Financial Select Sector SPDR Fund
- XLU: Utilities Select Sector SPDR Fund
- XLV: Health Care Select Sector SPDR Fund
- XLP: Consumer Staples Select Sector SPDR Fund
- XLI: Industrial Select Sector SPDR Fund
- XLY: Consumer Discretionary Select Sector SPDR Fund
- XLC: Communication Services Select Sector SPDR Fund
- XLRE: Real Estate Select Sector SPDR Fund
- XLB: Materials Select Sector SPDR Fund
These data points represent different sectors of the stock market.
The user can modify the "period" variable to specify the lookback period for calculating the correlation.
By changing the value of "Period," the user can adjust the number of historical data points used in the correlation calculation. Default value is 10 days.
How does the script work?
The script uses the ta.correlation function from TradingView's Pine Script to calculate the correlation between the daily returns of each sector ETF and the SPY. The daily return is calculated as the percentage change in price from the previous day.
The correlation calculation is performed for each sector ETF and the SPY, using the specified lookback period. The correlations are then averaged to obtain the average sector correlation to the SPY.
The resulting average sector correlation is plotted on the chart using a blue line.
How to use correlations when trading?
This script can be used to assess the overall market sentiment by measuring the average sector correlation to the SPY. When the average sector correlation is positive, it indicates that the sectors are generally moving in the same direction as the broader market (SPY). This suggests a strong market trend.
Traders can use this information to make informed trading decisions. For example, if the average sector correlation is strongly positive, it may be a signal to consider bullish positions in individual stocks or ETFs from sectors with high positive correlations. Conversely, if the average sector correlation is negative or weak, it may indicate a lack of market direction or potential sector rotation, requiring caution in trading decisions.
Furthermore, when correlation values are high and growing, it may signify a build-up of risk, suggesting that the sectors are moving in tandem due to widespread market forces. This can often be a signal of broader market participants chasing trends or reacting to panic. Therefore, this indicator can serve as a valuable tool for traders and investors who want to understand market sentiment and systemic risk at a glance.
The Average Sector Correlation indicator also provides the capability to monitor average correlations across multiple timeframes concurrently. This feature allows users to track the fluctuations of sector correlations over short, medium, and long-term periods, all simultaneously.
This function offers a more comprehensive view of the market dynamics and can alert users to changes in correlation patterns over various time horizons. Thus, users can gain insights into the immediate temperament of the market while also maintaining awareness of larger trends that may be forming or diminishing over extended periods. It presents a holistic image of market behaviour, enhancing the user's decision-making process.
Why use Correlations in combination with other indicators?
To enhance trading strategies, this script can be used in combination with other technical indicators or signals. By incorporating additional indicators such as moving averages, trend lines, or oscillators, traders can build a comprehensive trading system.
For example, traders can use the average sector correlation as a confirmation signal for other technical analysis tools. If a bullish signal is generated by another indicator, such as a moving average crossover or a breakout, the positive average sector correlation can provide additional confidence to enter or hold a long position.
Conversely, if a bearish signal is generated by another indicator, a negative average sector correlation can act as a confirmation signal to consider short positions or reduce exposure to sectors with low or negative correlations.
By combining multiple signals and indicators, traders can develop a well-rounded trading strategy that incorporates market breadth (sector correlations) along with other technical factors to increase the probability of successful trades.
It's important to note that while Correlations are a useful tool, it should not be relied upon solely for making trading decisions. It's recommended to use it in conjunction with other technical analysis tools and consider other factors such as Trend, market conditions, risk management, and fundamental analysis.
We hope that you will find these explanations useful.
Enjoy!
DISCLAIMER: No sharing, copying, reselling, modifying, or any other forms of use are authorised. This script is strictly for individual use and educational purposes only. This is not financial or investment advice. Investments are always made at your own risk and are based on your personal judgement. Myfractalrange is not responsible for any losses you may incur. Please invest wisely.
Correlation Coefficient - DXY & XAUPublishing my first indicator on TradingView. Essentially a modification of the Correlation Coefficient indicator, that displays a 2 ticker symbols' correlation coefficient vs, the chart presently loaded.. You can modify the symbols, but the default uses DXY and XAU, which have been displaying strong negative correlation.
As with the built-in CC (Correlation Coefficient) indicator, readings are taken the same way:
Positive Correlation = anything above 0 | stronger as it moves up towards 1 | weaker as it moves back down towards 0
Negative Correlation = anything below 0 | stronger moving down towards -1 | weaker moving back up towards 0
This is primarily created to work with the Bitcoin weekly chart, for comparing DXY and Gold (XAU) price correlations (in advance, when possible). If you change the chart timeframe to something other than weekly, consider playing with the Length input, which is set to 35 by default where I think it best represents correlations with Bitcoin's weekly timeframe for DXY and Gold.
The intention is that you might be able to determine future direction of Bitcoin based on positive or negative correlations of Gold and/or the US Dollar Index. DXY has been making peaks and valleys prior to Bitcoin since after March 2020 black swan event, where it peaked just after instead. In the future, it may flip over again and Bitcoin may hit major highs or lows prior to DXY, again. So, keep an eye on the charts for all 3, as well as the indicator correlations.
Currently, we've moved back into negative correlation between Bitcoin and DXY, and positive correlation with Bitcoin and Gold:
Negative Correlation b/w Bitcoin and DXY - if DXY moves up, Bitcoin likely moves down, or if DXY moves down, Bitcoin likely moves up (or if Bitcoin were to move first before DXY, as it did on March 2020, instead)
Positive Correlation b/w Bitcoin and Gold - Bitcoin and Gold will likely move up or down with each other.
DXY is represented by the green histogram and label, Gold is represented by the yellow histogram and label. Again, you can modify the tickers you want to check against, and you can modify the colors for their histograms / labels.
The inspiration from came from noticing areas of same date or delayed negative correlation between Bitcoin and DXY, here is one of my most recent posts about that:
Please let me know if you have any questions, or would like to see updates to the indicator to make it easier to use or add more useful features to it.
I hope this becomes useful to you in some way. Thank you for your support!
Cheers,
dudebruhwhoa :)
Bull Bear Correlation Tracker PaneThe Bull Bear Correlation Tracker is a versatile indicator designed to help traders identify the direction and strength of market trends by comparing the price action of multiple assets. It is particularly useful for those who are familiar with the carry trade principle, as it can detect when positively or negatively correlated assets move in favor or against the asset being traded. This indicator can be used for various markets, including crypto and forex, by simply adjusting the default options.
Key features of the Bull Bear Correlation Tracker include:
Multiple methods for determining trend direction: Supertrend, Pivot Point SuperTrend by LonesomeTheBlue, MACD - Zero Cross, and MACD - Grow/Shrink. These methods help traders identify the primary trend direction and potential trade opportunities.
Optional slow trend display for additional insights into market trends, allowing traders to analyze both short-term and long-term trends simultaneously.
Supports up to three symbols, enabling traders to analyze multiple assets simultaneously and better understand their correlation.
Assumed correlation settings to test traders' hypotheses about asset relationships, allowing traders to make informed decisions about potential correlations between different assets.
Customizable correlation period and smoothing settings to fine-tune the indicator's performance, providing traders with the ability to optimize the indicator based on their preferred trading style and market conditions.
Market hours filter to focus on specific trading hours, ensuring that the indicator only displays data during the hours specified.
Customizable color settings for easy visualization of trends, helping traders quickly identify the direction and strength of market trends.
Correlation histogram display to visualize asset relationships, providing traders with a clear visual representation of how different assets are correlated.
This indicator can be used to either force the correlation to be assumed positive or negative if the trader knows the correlation, or to use the actual data calculated between the traded asset and other assets if the correlation is broken often. This flexibility makes the Bull Bear Correlation Tracker suitable for trading various assets, including cryptocurrencies and forex, as well as for traders with different levels of experience.
By utilizing the Bull Bear Correlation Tracker, traders can gain valuable insights into market trends and correlations between different assets, helping them make more informed decisions and improve their trading strategies.
Note: I used back-testing for fine tuning do not base your trades on signals from the testing framework.
Negative Correlation SignalsThank you to Hendrik Fuchs who coded this for me - I highly recommend you...
The AUDUSD/EURUSD has a negative correlation with the DXY as does the GBPJPY/USDJPY have with the JPYX. This indicator is very simple and uses opposite candle pinbars (pinbar/doji structure can be set by you) of the two instruments on the chart whilst the stochastic RSI should be above 80 for overbought on the one but below 20 on the other for oversold (or vice versa) to generate a signal.
This indicator works as follow:
1. Choose an instrument that has an opposing negatively correlated instrument (EURUSD & DXY, GBPJPY & JPYX, US100 & VIX, etc.)
2. Add indicator to the chart and open settings.
3. Open the settings and add the correct instruments (default is set to GBPJPY & JPYX).
4. Enter your desired Stochastic RSI & candle formation settings.
You will see buy and sell signals appear on the charts. Alerts are possible (Any alert() function call). Does not repaint after close of candle. Better on higher timeframes but can also be used for scalping. Best used as confluence or as part of a trend trading system.
There are obviously many many variations that I have not even thought off - please let us know in the comment section if you find settings/timeframes/instruments that work particularly well.
Bitcoin Correlation MapHello everyone,
This indicator shows the correlation coefficients of altcoins with bitcoin in a table.
What is the correlation coefficient?
The correlation coefficient is a value that takes a value between 0 and 1 when a parity makes similar movements with the reference parity, and takes a value between 0 and -1 when it makes opposite movements.
In order to obtain more meaningful and real-time results in this indicator, the weighted average of the correlation values of the last 200bar was used. You can change the bar length as you wish. With the correlation value, you can see the parities that have similar movements with bitcoin and integrate them into your strategy.
You can change the coin list as you wish, and you can also calculate their correlation with etherium instead of bitcoin .
The indicator shows the correlation value of 36 altcoins at the moment.
The indicator indicates the color of the correlated parities as green and the color of the inversely correlated parities as red.
Cheers
Multi Delta-Agnostic Correlation Coefficient (tartigradia)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), 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:
Correlation ZonesThis indicator highlights zones with strong, weak and negative correlation. Unlike standard coefficient indicator it will help to filter out noise when analyzing dependencies between two assets.
With default input setting Correlation_Threshold=0.5:
- Zones with correlation above 0.5, will be colored in green (strong correlation)
- Zones with correlation from -0.5 to 0.5 will be colored grey (weak correlation)
- Zones with correlation below -0.5 will be colore red (strong negative correlation)
Input parameter "Correlation_Threshold" can be modified in settings.
Provided example demonstrates BTCUSD correlation with NASDAQ Composite . I advice to use weekly timeframe and set length to 26 week for this study
Kendall Rank Correlation Coefficient (alt)This is a non-parametric correlation statistical test, which is less sensitive to magnitude and more to direction, hence why some people call this a "concordance test".
This indicator was originally created by Alex Orekhov (everget), if you like this one, please show the original author some love:
This version is extended by tartigradia (2022) to make it more readily useable:
* Update to pinescript v5
* Default compare to current symbol (instead of only fixed symbols)
* Add 1.0, 0.0 and -1.0 correlation levels lines.
This indicator plots both the Kendall correlation in orange, and the more classical parametric Pearson correlation in purple for comparison. Either can be disabled in the Style tab.
gCorrelations
My layout of correlations. US Dollar and SP500 as references. My list of tickets consists of several subsets: Indices, Commodities, Financials and Currencies.
My Layout is 1x5
Correlation Frame 1x1 --> Daily perspective (timeframe 4h, lenght for calculation of correlation = 6)
Correlation Frame 1x2 --> Weekly perspective (timeframe 4h, lenght for calculation of correlation = 30)
Correlation Frame 1x3 --> Monthly perspective (timeframe 1D, lenght for calculation of correlation = 20)
Correlation Frame 1x4 --> 2-Monthly perspective (timeframe 1D, lenght for calculation of correlation =40)
Correlation Frame 1x5 --> 3-Monthly perspective (timeframe 1D, lenght for calculation of correlation = 60)
Correlation with P-Value & Confidence Interval (alt)Shows the Pearson correlation between two symbols, including statistical significance test.
This is a fork of the original script by Balipour, with the addition of EMA that can be used instead of SMA in the Pearson correlation as an attempt to capture correlation trend changes more quickly, and conversion to pinescript v5. In the end, the EMA does not help much, for a faster capture of correlation trend changes, another kind of correlation is necessary, such as sign test correlation (another one of my indicators implement this idea).
Please show the original indicator's author some love if you appreciate this work:
Delta-Agnostic Correlation Coefficient (alt)Calculate a sort of correlation between two symbols based only on the sign of their changes, regardless of the amplitude of price change.
When positive, the two symbols tend to move together. When negative, the symbols move in opposite directions.
Since there is no significance calculation, and that the result is binary, keep in mind that correlation will always tend to go towards 1 or -1 even when there is no correlation. To reduce this issue, an EMA or SMA is applied to smooth out transitions: SMA smoothes over the selected length period but adds lag, whereas EMA smoothes amplitude without any additional lag. Hence, to know if the correlation is true or not, try to look at the amplitude and the number of consecutive days the correlation is maintained (both quantities are related), because when the correlation is spurious, it will tend to switch more or less alternatively between 1 and -1 and hence will hover around 0, whereas if the correlation is true, it will get further away from 0 and closer to 1 or -1.
In addition, since there is some time lag for the correlation to switch sign, the area is colored to know the current candle's correlation, regardless of past data's correlation: blue is a positive correlation (1), yellow is negative. The coloring can allow to know a trend reversal early on, but it's noisy.
Finally, symbols with closing days are better accounted for, with the correlation set to 0 on closed days (e.g., on week-ends), and the area is then colored in gray to signal that there is no new correlation data.
This is an improved fork over the original indicator by alexjvale, please show him some love if you like this work:
L_BetaLibrary "L_Beta"
TODO: add library description here
length()
beta()
simple_beta()
index_selector()
Correlation with Matrix TableCorrelation coefficient is a measure of the strength of the relationship between two values. It can be useful for market analysis, cryptocurrencies, forex and much more.
Since it "describes the degree to which two series tend to deviate from their moving average values" (1), first of all you have to set the length of these moving averages. You can also retrieve the values from another timeframe, and choose whether or not to ignore the gaps.
After selecting the reference ticker, which is not dependent from the chart you are on, you can choose up to eight other tickers to relate to it. The provided matrix table will then give you a deeper insight through all of the correlations between the chosen symbols.
Correlation values are scored on a scale from 1 to -1
A value of 1 means the correlation between the values is perfect.
A value of 0 means that there is no correlation at all.
A value of -1 indicates that the correlation is perfectly opposite.
For a better view at a glance, eight level colors are available and it is possible to modify them at will. You can even change level ranges by setting their threshold values. The background color of the matrix's cells will change accordingly to all of these choices.
The default threshold values, commonly used in statistics, are as follows:
None to weak correlation: 0 - 0.3
Weak to moderate correlation: 0.3 - 0.5
Moderate to high correlation: 0.5 - 0.7
High to perfect correlation: 0.7 - 1
Remember to be careful about spurious correlations, which are strong correlations without a real causal relationship.
(1) www.tradingview.com
Greater Currency Correlation Matrix (Forex)Other available matrixes I found have a limited number of forex symbols. Consequentially, you need to keep switching them if you want to do a proper analysis. As a result of that, I produced my own currency matrix.
Correlation studies relationships between different price charts.
High correlation may be completely random in the short term, but it may signify a fundamental relationship between the two symbols if calculated over the long term.
For example, the currency of an oil-producing country may rally along with oil, whereas the importer's currency may drop. This means that watching the oil price chart may be worth it for such pairs.
The script includes all Major and Minor pairs with the addition of Gold (XAUEUR) and two optional symbols.
▬▬▬▬
To avoid too frequent use of security(), I decided to calculate all symbol values from EUR pairs. It should improve performance and keep room for some additional symbols in the future.
Please report any bugs.
SARWThis indicator aims to indicate the correlation between two assets(Current and Base), it does NOT show entries or help your chart analysis directly.
The main features of this Correlation indicator is :
Correlation type : Direct Correlation | Inverse Correlation | No Correlation
Correlation Percentage : as its name, it calculate the Correlation Percentage between Current and base assets if exist
How to use: Chose the base asset (default: bitcoin) and open any other chart to be the other -Current- asset
inputs:
Max Lookback length : how many candles will be included in the scan.
Swing intensity : How many candle should be counted to confirm a Swing, If you are confused leave it as its default.
Base Asset : The base asset to calculate the current asset correlation with.
Important Notes:
As I promised, the previous correlation indicator used each candle alone, while this one uses waves and swings.
The Current asset has more power over the base, because it compares the Base to current, but not the opposite((E.g. if you want to check if some coin have correlation with bitcoin, it's better to use bitcoin and put the other coin name in the input field)).
For any notes on the indicator to be edited, or for another indicator ideas please comment.
US Sector CorrelationsA new and interesting way to look at Breadth. As for the usefulness of it, one would have to do some proper backtesting to get a full grasp of the capabilities. This is just a concept currently. But in general, SPX holding near ATHs with very low sector correlations can be a topping indicator. SPX selling off with Correlations all very positive across each sector...can be a sign of an impending bottom. But, needs the "full bake" of proper testing and analysis versus just guessing. I like the concept and want to explore it further, and I will. This is just the start.
Delta Agnostic Correlation CoefficientVisually see how well a symbol tracks another's movements, without taking price deltas into account.
For example, a 1% move on the index and a 5% move on the target will return a DCC value of 1. An index move of 0.5% on the index and a 10% move on the target will also return a DCC value of 1. The same happens for downward moves.
The SMA value can be set to smooth the curve. A larger value creates a smoother curve.
Correlation Mandate for Relational AnalysisThis indicator is engineered to make relational analysis much easier.
If you used another window for each symbol, you would have to resize them all one by one. You don't need another timescale.
There are three modes:
► Independent - selected symbol candles are colored on their own.
► Correlational - selected symbol candles are colored depending on their relation to the chart symbol. If it is correlational, 1st color is chosen (both have Close higher than Open). 2nd color will be used for the opposite.
► Anti-Correlational - the opposite of Correlational
To display my indicator, I chose USDCAD and Oil. Canada has the second-largest oil reserves in the world and naturally, they are their neighbor's supplier. If the oil price goes up, USDCAD should be tanking, unless a different major influence(s) happen to be stronger at a time.
Good luck!
RSI Timeframes + Shadow
The RSI Timeframes + Shadow can be used to view RSI in different graphic times and at the same time analyze the RSI of another asset correlated with the current example: altcoins and BTC dominance, equities and SP500 , Brazilian equities and IBOV or FIIs and IFIX .
Fast RSI - yellow line
Slow RSI - white line
Correlational RSI - red line
It allows you to set an additional time frame different to the one on your chart. With this you could for example use a slower RSI than your other Strategy's candle period.
In the example the vertical lines in the graph show when the fast RSI crosses above the slow RSI represented by the cyan line and when the fast RSI crosses below the slow RSI represented by the red line.
You can also change the settings to view the RSI of other assets correlated with the current one to track them in the same graph time.
This indicator works with any available symbol.
#brazilian portuguese
O RSI Shadow pode ser utilizado para ver o RSI em tempos gráficos diferentes e ao mesmo tempo analisar o RSI de outro ativo correlacionado com o atual exemplo: Altcoins e dominância do BTC , acoes e SP500 , acoes brasileiras e IBOV ou FIIs e IFIX .
RSI rápido - linha amarela
RSI lento - linha branca
RSI correlacional - linha vermelha
Ele permite que você defina um período de tempo adicional diferente daquele em seu gráfico. Com isso, você pode, por exemplo, usar um RSI mais lento do que o período de vela da sua outra estratégia.
No exemplo as linhas verticais no gráfico mostra quando o RSI rápido cruza acima do RSI lento representado pela linha ciano e quando RSI rápido cruza abaixo do RSI lento representado pela linha vermelha.
Voce também pode alterar as configurações para visualizar o RSI de outro ativo correlacionado com o atual para acompanha eles no mesmo tempo gráfico.
Esse indicador funciona com qualquer simbolo disponível.
Ehlers Spearman Rank Indicator [CC]The Spearman Rank Indicator was created by John Ehlers (Stocks and Commodities July 2020 pg 6) and this works well as a trend confirmation indicator. This is obviously his take on the Spearman Ranking Correlation and make sure to let me know what you think! Buy when the line turns green and sell when it turns red.
Let me know if there are any other indicators you want me to publish!