Does your trading pass the seasonality test?Are you consistently beating the standard "Buy and Hold" benchmark?
Check your performance against the next most common strategy:
Buy at the start of the holiday season and close in the new year.
By default, the strategy starts with $100,000 and risks 25% of the account on each swing trade.
Commission is set to be 0.5% of each trade.
You can tweak the direction of trades by adjusting the first setting.
Tweak the holding period by changing the Entry and Exit months.
Red plot: Balance of account
Orange plot: Equity of account
Volatilidad histórica
Kolmogorov-Smirnov TestThe Kolmogorov–Smirnov test aims to tell you if the distribution of prices (or log returns) tends to follow a normal distribution or not. You can read about this test on Wikipedia . It seems to be a basic but trusted measure in the quantitative trading world.
When KS-t columns are blue, then it's safe to assume normal distribution. When they are red, the normal distribution assumption is proven wrong by the magnitude of the KS-t value.
In the plotting tab of the script, you can activate another option that displays the probability of the distribution being actually normal. It's values are bounded between 0 and 1, like all probabilities.
This test can be useful when using statistical concepts for trading markets, like standard deviations, z-scores, etc because they all depend on the assumption of prices (or log returns) being normaly distributed.
If you see something wrong, don't hesitate to message me.
Happy trading to all.
Put Call Auto [Nic]Looks up the put call ratio for select stocks, and draws them.
Does not support all stocks / equities, but does include a number of major ones.
ICT Time RangesICT Time Ranges is a concept around the fact that price likes to show volatility spikes in certain times of the day.
Although there are many other scripts such as that revolve around this concept, the difference between this one and some of the others out there is the fact that this code specifically focuses on the ranges like New York, London, Asia, and ICTs concept behind having a "True Day Range". Also, prior scripts draw horizontal lines to delineate the High and Low of the Day. Although this is useful in some cases, I find it to clutter up the chart too much for my liking, so this script negates any of that and simply prints a box in the parameters given within the settings pop-up. This also allows you the fact of having a shape and letter(s) marker for when a new day starts at 0:00.
With this script, you can enable / disable times of the day for:
- London Session
- New York Session
- London Close Session
- Asia Session
- "IPDA" True Day
You can also change the times that these sessions will update to, along with the opacity and color that they print to mark out these times / ranges. The same can be said with the "Day of Week" markers, which can be color coded and show different shapes / formats to your liking.
I find that putting the Session boxes opacity to 7-8% and the day of week markers to 20% is best as this makes them visible enough to see while also keeping it easy on your eyes to analyze your charts.
Overall, this script was based around specific concepts I liked from other individuals' scripts such as @BryceWH and @AvniPiro , but that are tweaked to what I personally find as most beneficial. To see others scripts like this one, you can search for "ICT Killzones" in the public script library!
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.
Relative Historical Volatility MCMRelative Historical Volatility
Historical Volatility is relative to it's doubled lookback period of the historical volatility to calculate relative historical volatility.
Including a standard deviation to calculate the volatility value itself is useless. It filters out 32% of the most volatile movements of the asset that you are observing.
Example of RHV:
Period of Volatility Value (POVV) : 10
Relative Historical Volatility : POVV / POVV*2
Historical Volatility of past 10 Bars is compared to the historical volatility of the bast 20 bars to show real growth/decrease of volatility relative to the time of the performing asset.
Comparing historical volatility to the current bar includes much more noise, the relative historical volatility can be perceived as a smoothed historical volatility ind.
Marginal notes:
Added standard deviations adjusted to the relative volatility value to predict probable future volatility of the stock.
Annualised Price Volatility %Annualised Price Volatility in percent, also called Instrument Risk, as outlined by Rob Carver in his excellent books, 'Systematic Trading' and 'Leveraged Trading'.
This is written for those who have read one of his books and want to use this tool on TradingView.
Trend strength, oscillators, and volume indicators are all the rage. Finding a great setup is, of course, key. You've decided to go long. Great!
But how much is your capital at risk?
How does that compare with your level of risk tolerance?
When trading, it's key to understand just how risky a certain instrument is. An uptrend is an uptrend, but is it at an annualised volatility of 2% per year or 500% per year? If it's the former, I know I can put a good chunk of capital into trading it. But if its the latter, I don't want to put so much money at risk. Volatility is rarely in a straight line. It's usually up and down.
I won't give the whole game away. To find out more about how to use this concept of risk, I'd highly recommend the books 'Leveraged Trading' and 'Systematic Trading' by Rob Carver.
Do you have any thoughts, ideas, or questions? Let me know in the comments or send me a message! I'd be glad to help you out.
All-time high and percentage dropsThis script calculates the ATH of whichever chart you use and plots it in blue
There is also an option to display the following ATH percentages: 90, 80, 70, 60, 50, 40 and 30 in white
Statistical and Financial MetricsGood morning traders!
This time I want to share with you a little script that, thanks to the use of arrays, allows you to have interesting statistical and financial insights taken from the symbol on chart and compared to those of another symbol you desire (in this case the metrics taken from the perpetual future ETHUSDT are compared to those taken from the perpetual future BTCUSDT, used as a proxy for the direction of cryptocurrency market)
By enabling "prevent repainting", the data retrieved from the compared symbol won't be on real time but they will static since they will belong to the previous closed candle
Here are the metrics you can have by storing data from a variable period of candles (by default 51):
✓ Variance (of the symbol on chart in GREEN; of the compared symbol in WHITE)
✓ Standard Deviation (of the symbol on chart in OLIVE; of the compared symbol in SILVER)
✓ Yelds (of the symbol on chart in LIME; of the compared symbol in GRAY) → yelds are referred to the previous close, so they would be calculated as the the difference between the current close and the previous one all divided by the previous close
✓ Covariance of the two datasets (in BLUE)
✓ Correlation coefficient of the two datasets (in AQUA)
✓ β (in RED) → this insight is calculated in three alternative ways for educational purpose (don't worry, the output would be the same).
WHAT IS BETA (β)?
The BETA of an asset can be interpretated as the representation (in relative terms) of the systematic risk of an asset: in other terms, it allows you to understand how big is the risk (not eliminable with portfolio diversification) of an asset based on the volatilty of its yelds.
We say that this representation is made in relative terms since it is expressed according to the market portfolio: this portfolio is hypothetically the portfolio which maximizes the diversification effects in order to kill all the specific risk of that portfolio; in this way the standard deviation calculated from the yelds of this portfolio will represent just the not-eliminable risk (the systematic risk), without including the eliminable risk (the specific risk).
The BETA of an asset is calculated as the volatilty of this asset around the volatilty of the market portfolio: being more precise, it is the covariance between the yelds of the current asset and those of the market portfolio all divided by the variance of the yelds of market portfolio.
Covariance is calculated as the product between correlation coefficient, standard deviation of the first dataset and standard deviation of the second asset.
So, as the correlation coefficient and the standard deviation of the yelds of our asset increase (it means that the yelds of our asset are very similiar to those of th market portfolio in terms of sign and intensity and that the volatility of these yelds is quite high), the value of BETA increases as well
According to the Capital Asset Pricing Model (CAPM) promoted by William Sharpe (the guy of the "Sharpe Ratio") and Harry Markowitz, in efficient markets the yeld of an asset can be calculated as the sum between the risk-free interest rate and the risk premium. The risk premium of the specific asset would be the risk premium of the market portfolio multiplied with the value of beta. It is simple: if the volatility of the yelds of an asset around the yelds of market protfolio are particularly high, investors would ask for a higher risk premium that would be translated in a higher yeld.
In this way the expected yeld of an asset would be calculated from the linear expression of the "Security Market Line": r_i = r_f + β*(r_m-r_f)
where:
r_i = expected yeld of the asset
r_f = risk free interest rate
β = beta
r_m = yeld of market portfolio
I know that considering Bitcoin as a proxy of the market portfolio involved in the calculation of Beta would be an inaccuracy since it doesn't have the property of maximum diversification (since it is a single asset), but there's no doubt that it's tying the prices of altcoins (upward and downward) thanks to the relevance of its dominance in the capitalization of cryptocurrency market. So, in the lack of a good index of cryptocurrencies (as the FTSE MIB for the italian stock market), and as long the dominance of Bitcoin will persist with this intensity, we can use Bitcoin as a proxy of the market portfolio
low and high X Bars//This script finds High and Low X bars back. Simple pine script, can customize lookback period.
Turkey Yield Curve SpreadYield spreads are used to see investors' perception of future risk and predict a recession. The spread is the value obtained by subtracting the near term bond from the distant one. This indicator plots this value historically. I used 3-year and 10-year Turkey treasury bond yields instead of 2-year and 10-year Turkey treasury bond yields due to lack of historical data on Tradingview.
Realized Volatility (annualized for any time frame)Plots standard deviation of returns (realized volatility), and annualizes it for the selected timeframe. Suitable for forex/cryptocurrencies which trade 24/7.
Indices Sector SigmaSpikes█ OVERVIEW
“The benchmark Dow Jones Industrial Average is off nearly 300 points as of midday today...”
“So what? Is that a lot or a little? Should we care?”
-Adam H Grimes-
This screener aims to provide Bird-Eye view across sector indices, to find which sector is having significant or 'out-of-norm' move in either direction.
The significance of the move is measured based on Sigma Spikes, a method proposed by Adam H. Grimes, where Standard Deviation of returns used as a baseline.
*You can google his blog or read his book, got some gold in there, especially on how he use indicators for trading
█ Understanding Sigma Spikes
As described by Grimes, moves in markets are only meaningful when we consider what “normal” is for that market.
Without that baseline, the daily change number, and even the percent change on the day doesn’t really mean much.
To overcome that problem, Sigma Spikes, as a measure of volatility, attempt to put todays change in price (aka return) in context of the standard deviation of 20 days daily's return.
Refer chart below:
1. The blue bars refer to each days return
2. The orange line is 1 time standard deviation of past 20days daily's return (today not included)
3. The red line is 2 time standard deviation of past 20days daily's return (today not included)
Using the ratio of today's return over the Std Deviation, determining your threshold (1,2,3,etc) will be the key that tells if today's move is significant or not.
*Threshold referring to times standard deviation, and different market may require different threshold.
*20 Days period are based on the Lookback Period, adjustable from user input window.
█ Features
- Scan up to 13 symbols at a time (Bursa (MYX) indices are defaulted, but you may change to any symbols/index from the user input setting)
█ Limitation
- Due to multiple use of security() function required to call other symbols, expect the screener to be slow at certain times
- Custom Timeframe currently accept only Daily and Weekly. I'll try to include lower timeframe in the next update
█ Disclaimer
Past performance is not an indicator of future results.
My opinions and research are my own and do not constitute financial advice in any way whatsoever.
Nothing published by me constitutes an investment recommendation, nor should any data or Content published by me be relied upon for any investment/trading activities.
I strongly recommends that you perform your own independent research and/or speak with a qualified investment professional before making any financial decisions.
Any ideas to further improve this indicator are welcome :)
Candle Height in Percentage - ColumnsThis indicator calculates the difference in percentage between lows and highs of a candle. The orange bars show the height of the candle body (open/close) and the red/green on top show the percentage of the wicks (high/low). This assists in understanding the volatility of an asset. Showing this in percentages is more helpful in crypto. It also shows the Simple Moving Average of this data with the blue line.
Average Low/High Percentage DifferenceThis indicator calculates the Simple Moving Average of the difference in percentage between lows and highs of a candle. This assists in understanding the volatility of an asset. Showing this in percentages is more helpful in crypto.
ADR% - Average Daily Range % by MikeC (AKA TheScrutiniser)This applies a 'corrected' formula to the version created by alpine_trader (which is slightly off). It calculates the Average Daily Range (in percent) over the previous 20 periods and plots it in a chart.
I am grateful to GlinckEastwoot for the 'corrected' formula.
OnTheMoveWith this plot one is able to compare the different % change in the given time frame. It calculates the sma of a given period (defval = 7) for the close/open.
Strategy would be to choose (trade) from one to other asset in order to get higher rates when pumping or lower when dumping.
The Symbol & exchange has to be specified.
defSymbols = BTC, ETH and LINK
defExchange = BINANCE
GBTC Fomo Panic PremiumIt is rumored that GBTC price action leads the Bitcoin market. This indicator compares GBTC fomo/panic levels to the (Binance) BTC spot market. Fomo is measured as large percentage moves of the high price from the min over a look-back period. Panic is measured as large percentage moves of the low price from the max over a look-back period. A prime example of this indicator's usage would be as a sell signal confirmation during the 2020 pre-Thanksgiving panic exhibited on the 1-hour chart while the 20 EMA was still above the 99 SMA.
You can customize the leading and lagging markets and the length of the lookback period. I would love to hear what parameters, markets and timeframes work for you. Maybe there is a way to leave comments, or hit me up on Twitter: @thirdreplicator
May you profit and enjoy.
Volatility Prism [Nic]What is this
The volatility rainbow tracks divergences in a security and its volatility index. This can be used to identify periods of heightened implied (future) risk.
About Volatility
The volatility is calculated by looking at put / call ratios. When VIX goes up it means that puts are outpacing calls. This is a bearish signal.
About Correlation
When the security goes up while the VIX goes up, the divergence on the plot will increase and turn a color. This should be a warning.
Volatility Rainbow
This is a similar indicator, but this one merges all signals into a single line.
IV/HV Ratio's [Nic]IV is implied volatility
HV is historic realized volatility
Seneca teaches that we often suffer more in our minds than in reality, and the same is true with the stock market. This indicator can help identify when people are over paying for implied volatility relative to real volatility . This means that short sellers are over paying for puts and can be squeezed into covering their positions, resulting in a massive rally.
The indicator can track this spread over many time frames, when the short time frame is much higher than the lower time frames, consider it a signal-of-interest.
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.
True Range in %I like to look at volatility in percentage and not in numbers. This is exactly what this script provides. It calculates the true range of a candle in percentage to the current price (for finished candles it uses it's close price).
The script also allows you to compare open and close prices.