Alferow_2active_correlationAn indicator showing the coefficient of linear correlation between two assets for the selected period. As the initial data, the following are set: the indicator of the candle, according to which the calculation is made (maximum, minimum, closing or opening); the period for analysis; two assets between which the correlation is considered. The output is a label with the value of the correlation coefficient.
Correlation
BTC Candle Correlation Strategy This is a special strategy adapted for crypto market, which instead of using the current chart candles, we use inside calculation a candle from different charts.
For best usage I recommend a big timeframe like 1-4h+.
In this case we take the high, low, open and close candles from different brokers for BTC, and with it we form up the candle that we are going to use for the logic of entry.
At the same time we are going to create an upper and lower bands using a moving average and the difference between high and low.
So in a way to put it, if BTC triggers a sell or buy order, we input instead these orders on the current chart, like in this example with ETH.
Rules for entry
For long : if we have a crossover of the btc source value with the upper band .
For short: if we have a crossunder of the btc source vale with the lower band.
For exit, we do it when we receive a different signal than the initial one.
This strategy does not have any other risk management inside, so use it with caution.
If you have any other questions, let me know !
Ehlers AutoCorrelation Indicator [CC]The AutoCorrelation Indicator was created by John Ehlers (Cycle Analytics pgs 94-98) and this can be viewed as both a momentum indicator and a trend indicator. This was his basis for several other indicators that he created which I will be publishing soon but essentially as this indicator goes up then the stock is in an uptrend and also has upward momentum. You will notice that this indicator starts to go down even during an uptrend showing that the underlying trend is going to have an upcoming reversal. He also warns that the halfway mark is a possible reversal point so keep an eye out for that.
Generally speaking a good signal is to enter a long position when the indicator is under the midline and is starting to go up (or when the line is green) and to exit the position when the indicator goes over the midline. I have included strong buy and sell signals in addition to normal ones so darker colors mean strong signals and lighter colors mean normal signals.
Let me know if there are any other indicators you would like me to publish!
Auto_Corr_DailyThis indicator shows the Pearson correlation coefficient between different periods of one financial instrument. Two dates are set, which are the starting points of two series, between which the correlation coefficient is calculated. The correlation period is taken from the difference of the current date from the second reference point. The indicator is designed to analyze the correlation only on the 1D timeframe.
Comparison CandlesPretty simple. Pick a security and it plots candlesticks to compare it to the current chart.
So if looking at CAKEBTC and comparing to UNIBTC, you get CAKEUNI.
Beats the hell out of plotting multiple plots and trying to compare them. No longer is your scale based on where your zoom starts.
Also allows you to draw oscillators from the plots.
Shown is my Uber RSI plotted on the comparison candles close on CAKEUNI (binance both).
No longer struggle to chart against messed up uniswap charts because your exchange of choice isn't listed on tradingview.
No longer struggle to chart ethereum pairs that don't exist on any of the exchanges supported officially by Tradingview charting.
"You just win."
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!
Correlation MatrixReturns a 4x4 correlation matrix between various user-selected symbols. Users can change the window of the correlation with the setting length .
Correlation matrices can be useful to see the linear relationship between various symbols, this is an important tool for diversification.
Correlation overlayThe script is intended to indicate when the correlation between VIX and VVIX gets below 0, on the selecteted security chart. It makes sense to plot it on indicies. This aims to present how the chart of a security looked like when the divergance between VIX and VVIX happened.
[SK] RSI/CCI Correlating OscillatorThe combination of RSI and CCI can be a powerful tool to efficiently signal the strength of the trend and upcoming reversals.
The magic comes when you're able to correlate both indicators correctly, this is the power I give you with the RSCCIO.
I've added additional features to each indicator that make signals more clear and easier to identify.
On the RSI
Directional color coding similar to what you can find on a MACD. This helps to identify the general trend ( above or below midline ) and the of the movement within.
For precise correlation the RSI is adjusted to a midline of 0. You can still enter the overbought/oversold levels as you'd expect on a regular RSI and it will be automatically adjusted.
On the CCI
Extreme strength / weakness color coding when the value exceeds the range makes signals more clear.
For precise correlation with the RSI, we need to scale down the value of the CCI with the Sensitivity Input. The default value works overall but feel free to play around to adjust the scale of the CCI movement.
---
RSI Relative Strength Index
The RSI is a momentum indicator that measures the magnitude of recent price changes. An asset is usually considered overbought when the RSI is above 70% and oversold when it is below 30%.
CCI Commodity Channel Index
The CCI was originally developed to spot trend changes. Use the CCI on the longer-term chart to establish the dominant trend and on the shorter-term chart to isolate pullbacks and generate trade signals.
MOVE/VXTLT CorrelationMany know of the VIX for equity trading. Yet, many are unaware that there is the same kind of volatility measure for trading bonds, called the MOVE Index.
"The Merrill Lynch Option Volatility Estimate (MOVE) Index is a yield curve weighted index of the normalized implied volatility on 1-month Treasury options which are weighted on the 2, 5, 10, and 30 year contracts."
With this script one can see the the correlation and divergences between bonds and its volatility measure to make educated decisions in trading or hedging.
The idea of this script comes from NicTheMajestic.
Correlation MeterThis script calculates the covariance and correlation coefficient between two markets using arrays.
Lookback: How many bars to perform the calculation on.
Source: Price source to calculate the correlation on.
Reference Market: The reference market to compare to the current market.
It's a simple indicator, but very useful for determining how correlated your preferred markets to trade are.
A correlation reading of +1.0 means the markets are perfectly positively correlated, a reading of -1.0 means they are perfectly negatively correlated.
If you're not sure what correlation & covariance are then Google the terms with "Investopedia" added to the end - they have some great definitions and examples.
For traders this can be useful for deciding how much risk to spread across two markets that have a high correlation, or how to hedge existing positions by trading a negatively correlated market.
For investors this can be useful for building a truly diversified portfolio.
If a market has a high positive correlation, the black line will stay above zero most of the time. If a market has a high negative correlation, the black line will stay below zero most of the time.
A market with no or little correlation will bounce between the two or hover around zero most of the time.
The example market above is comparing Apple's weekly price action to the S&P500's over the past 20 weeks. It has a high positive correlation as the black line is above zero most of the time.
Good luck with your trading!
RSI With Noise Elimination Technology (John Ehlers)Indicator translation to Pinescript requested by cookie_crusher on Twitter. The "RSI With Noise Elimination Technology" (NET) is an indicator developed by John Elhers.
The indicator is simply a rolling Kendall rank correlation coefficient of a normalized momentum oscillator (a version of the RSI introduced by Elhers in the May 2018 issue of Stocks & Commodities). It can be interesting to note that the absolute value of this oscillator is equal to the efficiency ratio used in the Kaufman adaptive moving average (KAMA).
Even if both the normalized momentum oscillator and rolling Rank correlation are scale-invariant oscillators, they do not have the same behaviors when increasing their settings, that is the normalized momentum oscillator scale range will become lower while the Kendall correlation will stay close to 1/-1, here is a closed-form approximation of the mean of the absolute value of the normalized momentum oscillator absolute value (efficiency ratio):
E (er) ≈ 1/√p
Where E (er) is the mean of the efficiency ratio er while p is the period of the efficiency ratio, as such the scale of the normalized momentum oscillator will shrink with a higher period, maybe that both are not intended to be plotted at the same time but that's what the original code does.
It's still a coll indicator. The link to J. Elhers article is in the code.
Linear Correlation OscillatorYou don't need loops to get the rolling correlation between an input series and a linear sequence of values, this can be obtained from the normalized difference between a WMA and an SMA of the input series.
The closed-form solutions for the moving average and standard deviation of a linear sequence can be easily calculated, while the same rolling statistics for the input series can be computed using cumulative sums. All these concepts were introduced in previous indicators posts long ago.
This approach can allow to efficiently compute the rolling R-Squared of a linear regression, as well as its SSE.
Using the rolling correlation as a trend indicator is often attributed to John Ehlers with the correlation trend indicator (Correlation As A Trend Indicator), but the applications of this precise method can be traced back quite a while ago by a wide variety of users, in fact, the LSMA can be computed using this precise indicator. You can see an example where the correlation oscillator appears below:
Correlation Oscillator - Anomaly AlertsThis script plots the correlation for two symbols as an oscillator:
A correlation of 1 means that both values move in the same direction together.
A correlation of -1 means that both values are perfectly negative correlated.
Parameter:
Length of the Correlation
The two symbols you want to calculate the correlation for
Barcolor: Defines whether Bar-coloring is set on.
The Number of bars lookback for anomaly: Say both are normally positively correlated it is an anomaly when the correlation turns negative and vica-versa.
Alerts: You can also set an Alert when an anomaly is detected.(blue dots on oscillator)
This has many use-cases:
For example VVIX and VIX are normally positive correlated.
When this turns negative, this can mean that we are on a turning point:
--> VVIX is rising while VIX is falling, risk of future Volatility is increasing (Top)
--> VIX is rising while VVIX is falling, risk of future Volatility is decreasing (Bottom)
Another use-case is just checking the correlation of stocks in your portfolio to diversify.
Session Range and Breakout Summary
This script presents the session range and post session movements relative to that range of all the majors and crosses on a single page. You can also set it to a daily range and weekly range (beta). It will even show you the pip value of the range. I made the indicator to easily stay on top of market movements at london open relative to the Asia session range. Its very easy to see which entire currency group is breaking its asia range WHIST ITS HAPPENING. Focus on NZD in the examples as it was the market lead today - I was able to get some of it when I saw the entire group breaking its range
Showing all the majors and crosses relative to the Asia range (00:00 - 07:00 GMT)
Active 'show on chart' to verify the indicator is measuring the range correctly. Compare below to the NZD box above - you can see how NZD had control of the market this morning and all NZD pairs broke out of their ranges.
'PIP MODE' - active pip mode to see what the pip range was of the session
Notes
The information is presented RELATIVELY - this means that all the ranges and movements are scaled to be the same size. You are therefore seeing the movements relative to their ranges. When you see a breakout it relative to the size of the range - for example, if GBPJPY had a range of 50pips and breaks out of the range by 100 pip and GBPEUR has a range of 20 pips and breaks out by 40 pips they have both broken out double the range and will be displayed as the same distance.
The indicator will show the movements whilst the range is forming. I did this so I can see what the groups are doing before Europe open and be ready - such as lingering at the top end of its INCOMPLETE asia range. Be aware through that if the lines are flat at the top of the range WHILST THE RANGE IS STILL FORMING this does not mean price was flat, it means that price was pushing up and growing the range. (Price can't breakout until the range has formed at the end of the session)
The currency pairs are organised to show the strength or weakness of the selected group - this means that the base currency is always the select group. This is to present the data with currencies moving in the same direction rather than some reversed but meaning the same in relation to currency strength. In the NZD example:
NZDAUD (not AUDNZD )
NZDCAD
NZDCHF
NZDEUR (not EURNZD )
NZDGBP (not GBPNZD )
NZDJPY
NZDUSD
I hope its useful. This is the most powerful indicator I've managed to write yet. It was difficult to make the code efficient enough to fit into the pinescript limit and still do everything.
Divergence Indicator [Nic]This divergence indicator can track the correlation between one or more symbols. I use it to track the divergences between the VIX volatility index, gold, bonds, as well as other market leading indicators.
When using with Vix, lower coefficients can lead to false signals. When in a high vix bear market signals, there is more noise and more false (or missing) signals can occur. Please use with other technical tools.
Voss Predictor (A Peek Into the Future) - Dr. John EhlersI have been sitting on this for over a year, but I now present this "Voss Predictive Filter" multicator employing PSv4.0 upon initial release, originally formulated by the great and empowering Dr. John Ehlers for TASC - August 2019 Traders Tips. This is a slightly modified version of the original indicator John Ehlers designed. My improved implementation is an all-in-one combination of three indicators, consisting of Ehlers' 2-pole bandpass filter, fed into the Voss predictor, and my Correlation Color. I also purposefully attempted to make this indicator work on both "Light" and "Dark" charts equally well.
You can search for this indicator's white paper, entitled "A PEEK INTO THE FUTURE By John Ehlers", on his site in the educational reference section. It's VERY important that you fully grasp how this indicator works and when it doesn't during trending price movements. According to "TV House Rules", I can't link directly to his white paper on his web site. Technically he's a vendor, even though it has been divulged to me, that he is intending to retire after his last and final wØℾk$#Øp, where he is publicly disseminating the bulk of his unpublished proprietary code that drives his other website VERY SOON.
I love John Ehlers in a respectfully appreciative manner and he is my hero in life! I simply don't revel about pretended celebrities and supposed rock stars. I will never be able to adequately explain to you how much he has influenced me AND this website as it currently exists AND what is in store for the future of the ever evolving "Power of Pine". His inspiring legacy of code poetry shall forever be immortally enshrined here on TV and influence it.
Back to the topic of interest, this script originating from John Ehlers' mind... This indicator helps to anticipate cyclic turning points via negative group delay. It is NOT a predictive crystal ball. Do not become cluelessly disillusioned by it's title. I need to explain.
For example, this indicator could not have anticipated that the bold faced lie of "15 Days to Slow the Spread" of the CHImeravirus "plandemic" in the USA, would turn into our factual reality of multi state mandated orders demanding months of unconstitutional prison cell styled lockdowns with closures and the absurd criminalization of not wearing a mouth mask made from underwear while not being evidently ill, additionally combined with 24/7 black magick mass hypnosis spoon feeding non-scientific fear based psychological propaganda from the world's "finest" epidemiological data analysts and misleaders, eventually decimating the world's markets into zombie economies with abhorrent results of long term massive unemployment and financial hardship on a chart scale never before witnessed. Yep, it's NOT capable of predetermining any of that. I just wanted to make that very clear by example in a metaphorical manner many people can relate to concerning Voss' ability to anticipate.
The indicator consists of a bandpass filter coupled to the Voss predictor. Also, one thing about the Voss predictor, it can catch minute turning points or even false ones as explained in the white paper. So... I included my Correlation Color as a fitting companion to aid you in filtering out false signals during trending price movements. The Voss Predictive Filter should never be used alone, be forewarned!
Features List Includes:
Dark Background - Easily disabled in indicator Settings->Style for "Light" charts or with Pine commenting
AND a few more... Why list them, when you have the source code to explore!
When available time provides itself, I will consider your inquiries, thoughts, and concepts presented below in the comments section, should you have any questions or comments regarding this indicator. When my indicators achieve more prevalent use by TV members , I may implement more ideas when they present themselves as worthy additions. Have a profitable future everyone!
VIX CorrelationIndicator tracks the 10 day correlation with VIX. I prefer to use this with SPY. Can be a great way to flag tops/melt-ups.
Default settings are set to when the correlation is above 0.2, bars turn red, but you can change this.
AutocorrelogramFast estimation of an autocorrelogram, more commonly called autocorrelation function (ACF). The script sets the maximum lag as 10*log10(N)-1 and sets the autocorrelation at lag 0 to 1.
Length controls the number of past observations of Src to use as input, while Differentiate Src perform first order differencing to Src before calculating the autoccorelations.
The ACF can return a lot of information, for technical analysis, the ACF can be used to determine whether the market is trending or ranging. Without prior processing, we expect trending prices to have a slowly decaying ACF with significant autocorrelation at each lag, while ranging prices will have an ACF that decay faster toward 0.
I won't post a lot on this profile, I'll post most of my future work on the LuxAlgo profile instead, link in the signature.
Spearman Rank Correlation CoefficientI'm pleased to introduce this script in honor of the new array functions introduced to PineScript version 4.0. This update is a long time coming and opens the door to amazing scripting possibilities!
Definition
Named after Charles Spearman and denoted by the Greek letter ‘ ρ ’ (rho), the Spearman rank correlation coefficient is the nonparametric version of the Pearson correlation coefficient . Use the Spearman rank correlation when you have two ranked variables, and you want to see whether the two variables covary. That is, as one variable increases/decreases, the other variable tends to increase/decrease respectively.
It is best used to discover if two variables (and in this first version of the indicator, two ticker symbols) increase and decrease together. There are advantages to using this version of correlation vs. the Pearson R.
Interpretation
The value oscillates between +1 and -1.
A value of +1 means the two variables are perfectly correlated, that is they are increasing and decreasing together in perfect harmony.
A value of -1 means the two variables exhibit a perfect negative correlation, that is they increase and decrease oppositely.
A value of zero means the two variables are not correlated at all (noise).
Neglected Volume by DGTVolume is one piece of information that is often neglected, however, learning to interpret volume brings many advantages and could be of tremendous help when it comes to analyzing the markets. In addition to technicians, fundamental investors also take notice of the numbers of shares traded for a given security.
What is Volume?
The volume represents all the recorded trades for a security that occurs in a given time interval. It is a measurement of the participation, enthusiasm, and interest in a given security. Think of volume as the force that drives the market. Volume substantiates, energizes, and empowers price. When volume increases, it confirms price direction; when volume decreases, it contradicts price direction.
In theory, increases in volume generally precede significant price movements. However, If the price is rising in an uptrend but the volume is reducing or unchanged, it may show that there’s little interest in the security, and the price may reverse.
A high volume usually indicates more interest in the security and the presence of institutional traders. However, a rapidly rising price in an uptrend accompanied by a huge volume may be a sign of exhaustion.
Traders usually look for breaks of support and resistance to enter positions. When security break critical levels without volume, you should consider the breakout suspect and prime for a reversal off the highs/lows
Volume spikes are often the result of news-driven events. Volume spike will often lead to sharp reversals since the moves are unsustainable due to the imbalance of supply and demand
note : there’s no centralized exchange where trades are recorded, so the volume data represents what happens at a particular exchange only
In most charting platforms, the volume indicator is presented as color-coded bars, green if the security closes up and red if the security closed lower, where the height of the bars show the amount of the recorded trades
Within this study, Relative Volume , Volume Weighted Bars and Volume Moving Average are presented, where Relative Volume relates current trading volume to past trading volume over long period, Volume Weighted Bars presents price bars colored based on short period past trading volume average, and Volume Moving Average is average of volume over shot period
Relative Volume is presented as color-coded bars similar to regular Volume indicator but uses four color codes instead two. Notable increases of volume are presented in green and red while average values with back and gray, hence adding ability to emphasis notable increases in the volume. It is kind of a like a radar for how "in-play" a security is. Users are allowed to change the threshold, default value is set to Fibonacci golden ration standard deviation away from its moving average.
Volume Weighted Bars, a study of Kıvanç Özbilgiç, aims to present if price movements are supported by Volume. Volume Weighted Bars are calculated based on shot period volume moving average which will reflect more recent changes in volume. Price actions with high volume will be displayed with darker colors, average volume values will remain as they are and low volume values will be indicated with lighter colors.
Volume Moving Average, Is short period volume moving average, aims to display visually the volume changes. Please not that Relative Volume bars are calculated based on standard deviation of long volume moving average.
What Else?
Apart from the volume itself, your ability to assess what volume is telling you in conjunction with price action can be a key factor in your ability to turn a profit in the market. It makes little sense to analyze the volume alone. To correctly interpret the volume data, it shall be seen in the light of what the price is doing. there are a lot of other indicators that are based on the volume data as well as price action. Analysing those volume indicators has always helped traders and investors to better understand what is happening in the market.
Here are the ones adapted with this study. Some of them used as a source for our aim, some adapted as they are with slight changes to fit visually to this study and please note that the numerical presentation may differ from their regular use
• On Balance Volume
• Divergence Indicator
• Correlation Coefficient
• Chaikin Money Flow
Shortly;
On Balance Volume
The On Balance Volume indicator, is a technical analysis indicator that relates volume flow to changes in a security’s price. It uses a cumulative total of positive and negative trading volume to predict the direction of price. The OBV is a volume-based momentum oscillator, so it is a leading indicator — it changes direction before the price
Granville, creator of OBV, proposed the theory that changes in volume precede price movements in a measurable way. He believed that volume was the main force behind major market moves and thought of OBV’s prediction of price changes as a compressed spring that expands rapidly when released.
It is believed that the OBV shows the interactions between the institutional and retail traders in the market
If the price makes a new high, the OBV should also make a new high. If the OBV makes a lower high when the price makes a higher high, there’s a classical bearish divergence — indicating that only the retail traders are buying. Another type of bearish divergence occurs when the price remains relatively quiet and fails to make a higher high but the OBV soars higher than the previous high — indicating that the institutional traders are accumulating short positions. On the other hand, if the price makes a lower low and the OBV makes a higher low, there is a classical bullish divergence, showing that the institutional traders don’t believe in that move
With this study, Momentum and Acceleration (optional) of OBV is calculated and presented, where momentum is most commonly referred to as a rate and measures the acceleration of the price and/or volume of a security. It is also referred to as a technical analysis indicator and oscillator that is able to determine market trends.
Additionally, smoothing functionality with Least Squares Method is added
Divergences especially, should always be noted as a possible reversal in the current trend, so the divergence indicator is adapted with this study where the Momentum of OBV is assumed as Oscillator with similar usages as to RSI. Divergence is most often used to track and analyze the momentum in an asset’s price and the odds of a price reversal within the current trend. The divergence indicator warns traders and technical analysts of changes in a price/volume trend, oftentimes that it is weakening or changing direction.
Correlation Coefficient
The correlation coefficient is a statistical measure of the strength of the relationship between the relative movements of two variables. A correlation of -1.0 shows a perfect negative correlation, while a correlation of 1.0 shows a perfect positive correlation. A correlation of 0.0 shows no linear relationship between the movement of the two variables. In other words, the closer the Correlation Coefficient is to 1.0, indicates the instruments will move up and down together as it is mostly expected with volume and price. So the Correlation Coefficient Indicator aims to display when the price and volume (on balance volume) is in correlation and when not. With this study blue represent positive correlation while orange negative correlation. The strength of the correlation is determined by the width of the bands, to emphasis the effect horizontal lines are drawn with values set to 0.5 and -0.5. the values above 0.5 (or below -0.5) shows stronger correlation.
Chaikin Money Flow , provide optionally as a companion indicator
The Chaikin money flow indicator (CMF) is a volume indicator that measures the money flow volume over a chosen period. The money flow volume is a measure of the volume and where the price closed relative to the trading session’s range. It comes from the idea that buying pressure is indicated by a rising volume and recurrent closes in the upper part of the session’s price range while selling pressure is demonstrated by an increasing volume and repeated closes in the lower part of the price range.
Both buying and selling pressures are accompanied by an increase in volume, but the location of the closing prices are in accordance with the direction of price
Special thanks to @InvestCHK and @hjsjshs , who have enormously contributed while preparing this study
related studies:
Disclaimer:
Trading success is all about following your trading strategy and the indicators should fit within your trading strategy, and not to be traded upon solely
The script is for informational and educational purposes only. Use of the script does not constitute professional and/or financial advice. You alone have the sole responsibility of evaluating the script output and risks associated with the use of the script. In exchange for using the script, you agree not to hold dgtrd TradingView user liable for any possible claim for damages arising from any decision you make based on use of the script
Fama-French 3 Factor ModelFama-French 3 Factor Model
Extension of the Capital Asset Pricing Model (CAPM)
CAPM
Ra = Rfr +
where,
Ra = Return of the Asset
Rfr = Risk-Free Rate
βa = Beta Coefficient of the Asset
Rm - Rfr = Market Risk Premium
Fama-French 3 Factor
r = rf + β1*(rm - rf) + β2(smh) +β3(hml)
r = Expected rate of return
rf = Risk-free rate
ß = Factor’s coefficient (sensitivity)
(rm – rf) = Market risk premium
SMB (Small Minus Big) = Historic excess returns of small-cap companies over large-cap companies
HML (High Minus Low) = Historic excess returns of value stocks (high book-to-price ratio) over growth stocks (low book-to-price ratio)
Small is set to $EWSC
Invesco S&P SmallCap 600® Equal Weight ETF
Big is set to $EQLW
Invesco S&P 100 Equal Weight ETF
High is set to $IUSV
iShares Core S&P US Value ETF
Low is set to $IUSG
iShares Core S&P US Growth ETF
returns selections
'returns'
'logarithmic returns' (use for realized (historical) returns)
'geometric returns' (compounded returns)
risk-free rate selections:
$DTB3
$DGS2
$DGS5
$DGS10
$DGS30
tf = primary time-frame
rtf = reference time-frame