Relative Performance AnalysisRelative Performance Analysis Script
This Pine Script creates a detailed table on your TradingView chart to compare the performance of a specified asset against a benchmark over multiple time frames. The table is fully customizable, allowing you to select its location on the chart and display performance metrics for different periods.
Features:
Customizable Table Location: Choose where the table appears on your chart from a range of predefined positions (e.g., bottom left, top center).
Dynamic Column Headers: The table includes columns for the ticker, description, and performance metrics for various time periods (1 day, 1 week, 1 month, 3 months, 6 months, and 1 year).
Performance Calculation: Calculates the percentage change in performance between the current close price and the previous close price for each time frame.
Color-Coded Performance: Uses a color scheme to highlight performance levels, with specific colors for positive and negative changes to easily visualize performance trends.
Benchmark and Asset Comparison: Displays performance metrics for both a benchmark (e.g., SPY) and the asset currently viewed on the chart, providing a clear comparison.
Inputs:
Benchmark Symbol: Specify the symbol of the benchmark asset (e.g., SPY).
Benchmark Description: Provide a description for the benchmark asset.
Chart Symbol: Automatically uses the symbol of the chart for comparison.
Usage:
Add the script to your TradingView chart.
Configure the benchmark symbol and description as needed.
The table will automatically populate with performance data and be positioned according to your selection.
Disclaimer:
This script is for informational and educational purposes only and is not intended as financial advice. The performance data displayed in the table is based on historical prices and is not indicative of future performance. Trading involves risk, and you should always do your own research and consult with a qualified financial advisor before making any investment decisions. The creator of this script assumes no responsibility for any losses or damages incurred as a result of using this tool.
Benchmark
Relative Strength according to Oster (RSO)Overview:
Relative Strength according to Oster (RSO) is an innovative tool that redefines how traders assess an asset's market strength. Moving beyond traditional indicators, RSO offers a sophisticated and highly responsive measure of an asset's potential to continue performing well. By integrating groundbreaking methodologies, RSO equips traders with unparalleled insights into market dynamics, making it an essential tool for anyone looking to stay ahead in today's fast-paced trading environment.
Understanding RSL (Relative Strength according to Levy):
At its core, Relative Strength according to Levy (RSL) is a powerful concept rooted in the idea that an asset currently exhibiting strength is more likely to maintain or even enhance that strength in the future. RSL calculates this by comparing an asset's current price to its moving average, providing a clear picture of its relative performance over time. The further its value is above 1, the higher the market momentum and vice versa. This relationship to the moving average is crucial, as it indicates not just where the asset stands today but also its trajectory in the context of historical performance. The ability to identify assets that consistently outperform is a game-changer for traders, and RSL has long been a cornerstone in this pursuit.
RSO vs. Traditional RSL: A Leap Forward
The RSO takes the traditional RSL concept and propels it into new territory with its innovative correlation-based approach. This is where RSO truly shines, offering a unique and sophisticated analysis that goes far beyond the basics.
Why RSO is Revolutionary:
Correlation Adjustment: The RSO doesn’t just measure an asset’s strength in isolation. Instead, it adjusts its readings based on how closely the asset's price movements correlate with a chosen benchmark. This groundbreaking feature ensures that the RSO is not just reactive to past performance but also predictive of how the asset might behave relative to the broader market, adding a layer of precision that is unparalleled in traditional strength indicators.
Superior Strength Option: With the RSO, traders have the option to include superior strength factors, adding another dimension of insight. This feature allows for more stable and reliable long-term signals. On the flip side, those who prefer a more dynamic trading style can opt to exclude this factor for more frequent, shorter-term signals. This level of customization is rare and sets the RSO apart as a truly adaptable tool.
Enhanced Market Insights: RSO’s correlation-based approach doesn’t just show how strong an asset is—it reveals how that strength is likely to develop in relation to the benchmark's underlying trends. This isn’t merely about comparing performance; it’s about understanding the asset’s potential trajectory in a much broader market context. Such insight is invaluable for making informed, strategic trading decisions.
Practical Application:
The RSO isn’t just innovative in theory; it’s designed for practical, real-world trading. Traders can set customized alerts based on RSO’s readings, ensuring they’re always aware of key buy or sell signals as they occur. The flexibility to include or exclude superior strength factors means that RSO can be tailored to fit any trading style, whether focused on long-term investments or short-term opportunities.
Conclusion:
In conclusion, the Relative Strength according to Oster (RSO) is more than just an indicator; it’s a breakthrough in market analysis. By integrating correlation adjustments and offering unparalleled customization options, RSO provides traders with insights that are both deeper and more actionable than ever before. This innovative tool is designed to empower traders, giving them the edge they need to succeed in an increasingly complex market landscape. Whether you’re a seasoned trader or just starting out, the RSO is a must-have tool for navigating market trends with confidence and precision.
Normalized Performance ComparisonThis script visualizes the relative performance of a primary asset against a benchmark composed of three reference assets. Here's how it works:
User Inputs:
- Users specify ticker symbols for three reference assets (default: Platinum, Palladium, Rhodium).
Data Retrieval:
- Fetches closing prices for the primary asset (the one the script is applied to) and the three reference assets.
Normalization:
- Each asset's price is normalized by dividing its current price by its initial price at the start of the chart. This allows for performance comparison on a common scale.
Benchmark Creation:
- The normalized prices of the three reference assets are combined to create a composite benchmark.
Ratio Calculation:
- Computes the ratio of the normalized primary asset price to the combined normalized benchmark price, highlighting relative performance.
Plotting:
- Plots this ratio as a blue line on the chart, showing the primary asset's performance relative to the benchmark over time.
This script helps users quickly assess how well the primary asset is performing compared to a set of reference assets.
Pivots Benchmark For Indicators (MA / OSC) This measures the pivot of your source. the peaks and valleys. and, shows ou some neat statistics if you were to use those as your entry/exit points. I consider it a purist MA designers Acid Test. if you can get good numbers on this, (remember to deduct fees), you probably should feel confident in your indicator's quality. it isn't very forgiving.
170 themes Dark/Light
your choice of highlight colour for Best/Worst achievement values.
compare to open/close average, or a 3 length EMA on close.
display solo bench of your source.
help popup for indicator values, (hideable)
show/hide individual pivot distances, which source to measure as pivot
time to measure historical setting
number of pivots to keep in buffer
it does back test and runs live!
Closed Source for now, as it is a demo version i've made with partial capabilities.
it's part of a set of performance benchmarks i hope to have finished soon.
when i release the major components i've been building up to for 2 years,
this and everything else will be open sourced.
SFC Smart Money BenchmarkA benchmark is a standard or point of reference, which traders can use to measure something else.
This indicator is showing how correlated pairs are performing and what is the current correlation between them.
Features:
- Market performance - daily, weekly, monthly
- Sigma - volatility . It will be coloured in red, if the volatility is bigger than one standard deviation.
-Correlation - Positive correlation will be coloured in green if it is confirmed by the P-value, negative correlation in red.
-Confidence intervals
-Determination
Markets:
- Metal sector
- US Stock Indices
- Major USD Pairs
Market performance
The indicator is plotting a table with the current performance of the particular group, for example the metal sector and all correlated Gold pairs. The table is showing the performance of the pairs based on monthly, weekly and daily bases in the same time. In this case the trader can track all pairs simultaneously and see if there are anomalies between the pairs - SMT Divergence.
For example:
We know that Gold and Silver are very strong correlated pairs. In this case if Gold is going up, but Silver not, probably this move is only current manipulation and the true move is not clear. In that moment the trader can decide not to open an order or take some profit.
With the Sigma value traders also can track the current volatility of the price. The strength of the volatility is measured by the standard deviation.
-1>Sigma<1 - The asset is moving normally
-2>Sigma<-1 or 21 - The asset is volatile
-3>Sigma<-2 or 32 - The asset is very volatile
Correlation
The indicator is showing the current correlation between all pair from the table. The correlation is set to the first pair of the table. In order to make the correlation more accurate the indicator calculates the P-value and the Determination coefficient. The confidence intervals are also displayed in order to show how strong correlation should be expected.
Pearson correlation is a measure of linear correlation between two sets of data. It is the ratio between the covariance of two variables and the product of their standard deviations; thus, it is essentially a normalized measurement of the covariance, such that the result always has a value between −1 and 1. As with covariance itself, the measure can only reflect a linear correlation of variables, and ignores many other types of relationships or correlations.
P-value evaluates how well your data rejects the null hypothesis, which states that there is no relationship between two compared groups. Successfully rejecting this hypothesis tells you that your results may be statistically significant. In academic research, p-value is defined as the probability of obtaining results ‘as extreme’ or ‘more extreme’, given that the null hypothesis is true — essentially, how likely it is that you would receive the results (or more dramatic results) you did assuming that there is no correlation or relationship (e.g. the thing that you’re testing) among the subjects
Coefficient of Determination is just the square of pearson’s correlation coefficient R. This is done as it is easier to explain linear regression in terms of R² than R. As R ranges from -1 to 1, R² would range from 0 to 1 — clearly explaining relationship with 0 being not related and 1 being perfectly related.
The correlation confidence interval is the range in which the population correlation is most likely to be found.
The degree of certainty for which it is likely to be within that range is called the confidence level.
When you collect sample data, you can not know the exact value of the correlation.
Note:
For the Stock indices there is an extra calculation, showing the current market expectations - Fear and Greed Index. The calculated index could differs a bit from the original CNN Fear and Greed indicator, because they calculate the index based on Future markets. This indicator calculate the index based on the market that we trade - indices.
Supported pairs:
-Option Gold - XAUUSD , GDX , Silver , Aluminum, Platinum , Palladium, 30Y US Yields, 10Y US Yields, 2Y US Yields, XAUEUR, XAUGBP, XAUAUD , XAUCAD , XAUCNY , XAUJPY
-Option Others - Table1: SP500 , US30, NAS100 ; Table2: DXY , EURUSD , GBPUSD , AUDUSD
Spot Index Generator - The Quant Science Create your own spot index and compare returns with a benchmark. With this tool you will be able to quickly check if your portfolio management is better than the benchmark. It is a professional tool suitable for medium to long-term investors who need to create a personal and custom index with only spot assets and need to compare it with the return of a specific market.
Features
You can create your own indexes using up to 10 different assets. Through the user interface you can adjust the weight for each asset, and the initial capital with which to build the index.
Quantitative Data
1. Index Return vs. Benchmark Return
Compare your personal index with the benchmark.
2. Index Average Return vs. Index Return
Compare the return of your index with the average of returns. You can adjust the averaging through the user interface.
3. Volatility Index Analysis using Index Return and Average Index Return
Show the volatility of your index move over key levels created using the average of your index returns.
For the example used in the chart, we created a custom index for the crypto market, including 8 different assets:
1. KUCOIN:ETHUSDT , 10%
2. BINANCE:BNBUSDT , 10%
3. BINANCE:MATICUSDT , 20%
4. BINANCE:AVAXUSDT , 5%
5. BINANCE:SOLUSDT , 5%
6. KUCOIN:GODSUSDT , 10%
7. KUCOIN:SANDUSDT , 10%
8. BITGET:SHIBUSDT , 30%
The reference benchmark is KUCOIN:SANDUSDT .
The period of analysis start at January 1, 2023 to today.
Timeframe selected: 5 min
Capital: 1000 USDT
Following the benchmark analysis, the built index (lime color) does not perform better than the benchmark (blue color). As can be seen, the index created a lower return than the benchmark.
BETA (against any benchmark index - defaulted to NSE:NIFTY)Beta value of a stock relative to benchmark index. Thanks to Ricardo Santos for the original script. This script is adapted from it.
To understand beta, refer Investopedia link: www.investopedia.com
A beta value of 1 means the stock is directly correlated to benchmark index - volatility would be same as overall market.
Beta value less than 1 and greater than 0 means the stock is less volatile than the market.
Beta value more than 1 would mean the stock is more volatile than the market.
A beta value of 1.2 would roughly translate to the stock being 20% more volatile than the overall market.
A negative beta value indicates the stock is inversely correlated to market.
In the example chart, you can see the Beta value change in NSE:RELIANCE with respect to NSE:NIFTY.
Godmode 4.0.2 [Supply/Demand]First off, a huge thank you to the following people:
LEGION:
LazyBear: www.tradingview.com
xSilas: www.tradingview.com
Ni6HTH4awK: www.tradingview.com
sco77m4r7and:
SNOW_CITY: www.tradingview.com
oh92: www.tradingview.com
alexgrover: www.tradingview.com
cI8DH: www.tradingview.com
DonovanWall: www.tradingview.com
shtcoinr: www.tradingview.com
This is the third iteration of Godmode. This time I borrowed the method used by shtcoinr to render supply/demand, resistance and support zones. The idea here is to input the appropriate benchmark tickerid to the asset class you're trading and to paint zones according to the price activity of the selected tickerid. This works very well trying to paint meaningful zones against noisy stocks, currencies, commodities etc. Use a correlation coefficient to determine the best benchmark for your asset class.
Want to Learn?
If you'd like the opportunity to learn Pine but you have difficulty finding resources to guide you, take a look at this rudimentary list: docs.google.com
The list will be updated in the future as more people share the resources that have helped, or continue to help, them. Follow me on Twitter to keep up-to-date with the growing list of resources.
Suggestions or Questions?
Don't even kinda hesitate to forward them to me. My (metaphorical) door is always open.
Godmode 4.0.1 [Correlator]First off, a huge thank you to the following people:
@LEGION:
@LazyBear: www.tradingview.com
@xSilas: www.tradingview.com
@Ni6HTH4awK: www.tradingview.com
@sco77m4r7and:
@SNOW_CITY: www.tradingview.com
@oh92: www.tradingview.com
@alexgrover: www.tradingview.com
@cI8DH: www.tradingview.com
@DonovanWall: www.tradingview.com
This is my second iteration of Godmode. This time I allowed the possibility to correlate two benchmarks against one another, thereby giving you twice the signals (once there's a strong correlation between the two, inverse or otherwise). That aside, there are no changes to this indicator that the first iteration doesn't have:
There are still more iterations planned, but if you guys have any ideas or wishes regarding what direction I go, then please let me know.
Want to Learn?
If you'd like the opportunity to learn Pine but you have difficulty finding resources to guide you, take a look at this rudimentary list: docs.google.com
The list will be updated in the future as more people share the resources that have helped, or continue to help, them. Follow me on Twitter to keep up-to-date with the growing list of resources as well as any other scripts I publish.
Suggestions or Questions?
Don't even kinda hesitate to forward them to me. My (metaphorical) door is always open.
Godmode 4.0.0 [Oscillator]First off, a huge thank you to the following people:
LEGION:
LazyBear: www.tradingview.com
xSilas: www.tradingview.com
Ni6HTH4awK: www.tradingview.com
sco77m4r7and:
SNOW_CITY: www.tradingview.com
oh92: www.tradingview.com
alexgrover: www.tradingview.com
cI8DH: www.tradingview.com
DonovanWall: www.tradingview.com
Since I've been on TradingView I've become somewhat enthralled by Godmode and the collective work that goes in to it, so I decided to publish my own iteration, building off the ideas already present. (This is a great way to get familiar with Pine by the way, just in case there are any beginners reading this)
Changes
The first change I made was to allow the user to select whatever tickerid they wanted as a benchmark. If trading XBTUSD on BitMEX for example, the indicator will react to exchange-specific activity, which means it will respond to all the little whipsaws, whipsaws that can be especially present on a futures exchange. By typing CRYPTOCAP:BTC or CRYPTOCAP:TOTAL we endeavor to remove noise. It can also signal earlier. Less noise and less lag. Another idea would be to choose a benchmark that has a strong inverse relationship with the asset you're trading: try CRYPTOCAP:USDT as the benchmark against BTC to see what I mean.
I also added the ability to smooth the plot, yet again removing noise but adding considerable lag.
The linear regression of the wave-trend is calculated in place of the EMA. This is plotted as columns with the midline (50) as the base. This is just calculating the slope of the wave-trend and can signal a weakening trend before a reversal takes place.
Using cI8DH's True RSI script () as inspiration, I added a function for calculating the True TSI in an attempt to remove any bullish bias. Funnily enough, when I tried to do the same with the RSI I had some problems. I'll try to resolve this in the coming weeks.
Made slight changes to the aesthetics. Tried to bring the two main plots alive by making their bold, opaque colors stand off the subtle tones in the background.
To Do List
1. I would like to sort out the issue with the True RSI.
2. When the plots are smoothed, there's an issue with the green 'Caution!' dots appearing in the lower half of the indicator.
3. I'd like to adjust the code so that if the 'Benchmark' box is empty, that it will automatically register the current tickerid as the 'Benchmark'.
If anyone has any suggestions on other fixes or how to apply the fixes mentioned by me, please don't hesitate to reach out to me here or through other media platforms.
Want to Learn?
If you'd like the opportunity to learn Pine but you have difficulty finding resources to guide you, take a look at this rudimentary list: docs.google.com
The list will be updated in the future as more people share the resources that have helped, or continue to help, them. Follow me on Twitter to keep up-to-date with the growing list of resources.
Suggestions or Questions?
Don't even kinda hesitate to forward them to me. My (metaphorical) door is always open.
BITMEX:XBTUSD
CRYPTOCAP:BTC
CRYPTOCAP:TOTAL
CRYPTOCAP:USDT.D
Moving Average Smoothness BenchmarkHey there!
This tool will help you to choose a moving average/filter that has the lowest lag throughout the whole history for the specified period.
What does it do?
It calculates the mean absolute errors for each moving average or filter and shows histogram with results. The lower error the lower lag of the moving average.
So, the best average will be at the end of the list of labels on the chart.
Settings
The main setting is a period for all moving averages.
Additionally, it allows to customize some multi-parametric moving average such as JMA, ALMA, McGinley Dynamic, Tillson's T3, REMA, Adaptive Laguerre Filter, Hampel Filter, Recursive Median Filter and Middle-High-Low MA.
NOTE : The results may vary on the different tickers and timeframes. This tool measures the performances on the current ticker and on the current timeframe.
Supported averages/filters (use short titles to match movings on the chart)
SMA, Simple MA
EMA, Exponential MA
WMA, Weighted (Linear) MA
RMA, Running MA (by J. Welles Wilder)
VWMA, Volume Weighted MA (by Buff P. Dormeier)
AHMA, Ahrens MA (by Richard D. Ahrens)
ALMA, Arnaud Legoux MA (by Arnaud Legoux and Dimitris Kouzis-Loukas)
ALF, Adaptive Laguerre Filter (by John F. Ehlers)
ARSI, Adaptive RSI
DEMA, Double Exponential MA (by Patrick G. Mulloy)
EDCF, Ehlers Distance Coefficient Filter (by John F. Ehlers)
EVWMA, Elastic Volume Weighted MA (by Christian P. Fries)
FRAMA, Fractal Adaptive MA (by John F. Ehlers)
HFSMA, Hampel Filter on Simple Moving Average
HFEMA, Hampel Filter on Exponential Moving Average
HMA, Hull MA (by Alan Hull)
HWMA, Henderson Weighted MA (by Robert Henderson)
IIRF, Infinite Impulse Response Filter (by John F. Ehlers)
JMA1, Jurik MA with power of 1 (by Mark Jurik)
JMA2, Jurik MA with power of 2 (by Mark Jurik)
JMA3, Jurik MA with power of 3 (by Mark Jurik)
JMA4, Jurik MA with power of 4 (by Mark Jurik)
LF, Laguerre Filter (by John F. Ehlers)
LMA, Leo MA (by ProRealCode' user Leo)
LSMA, Least Squares MA (Moving Linear Regression)
MD, McGinley Dynamic (by John R. McGinley)
MHLMA, Middle-High-Low MA (by Vitali Apirine)
REMA, Regularized Exponential MA (by Chris Satchwell)
RMF, Recursive Median Filter (by John F. Ehlers)
RMTA, Recursive Moving Trend Average (by Dennis Meyers)
SHMMA, Sharp Modified MA (by Joe Sharp)
SWMA, Sine Weighted MA
TEMA, Triple Exponential MA (by Patrick G. Mulloy)
TMA, Triangular MA
T3, (by Tim Tillson)
VIDYA, Variable Index Dynamic Average (by Tushar S. Chande)
ZLEMA, Zero Lag Exponential MA (by John F. Ehlers and Ric Way)
BF2, Butterworth Filter with 2 poles
BF3, Butterworth Filter with 3 poles
SSF2, Super Smoother Filter with 2 poles (by John F. Ehlers)
SSF3, Super Smoother Filter with 3 poles (by John F. Ehlers)
GF1, Gaussian Filter with 1 pole
GF2, Gaussian Filter with 2 poles
GF3, Gaussian Filter with 3 poles
GF4, Gaussian Filter with 4 poles
Good luck and Merry Christmas!