Rolling Risk-Adjusted Performance RatiosThis simple indicator calculates and provides insights into different performance metrics of an asset - Sharpe, Sortino and Omega Ratios in particular. It allows users to customize the lookback period and select their preferred data source for evaluation of an asset.
Sharpe Ratio:
The Sharpe Ratio measures the risk-adjusted return of an asset by considering both the average return and the volatility or riskiness of the investment. A higher Sharpe Ratio indicates better risk-adjusted performance. It allows investors to compare different assets or portfolios and assess whether the returns adequately compensate for the associated risks. A higher Sharpe Ratio implies that the asset generates more return per unit of risk taken.
Sortino Ratio:
The Sortino Ratio is a variation of the Sharpe Ratio that focuses specifically on the downside risk or volatility of an asset. It takes into account only the negative deviations from the average return (downside deviation). By considering downside risk, the Sortino Ratio provides a more refined measure of risk-adjusted performance, particularly for investors who are more concerned with minimizing losses. A higher Sortino Ratio suggests that the asset has superior risk-adjusted returns when considering downside volatility.
Omega Ratio:
The Omega Ratio measures the probability-weighted ratio of gains to losses beyond a certain threshold or target return. It assesses the skewed nature of an asset's returns by differentiating between positive and negative returns and assigning more weight to extreme gains or losses. The Omega Ratio provides insights into the potential asymmetry of returns, highlighting the potential for significant positive or negative outliers. A higher Omega Ratio indicates a higher probability of achieving large positive returns compared to large negative returns.
Utility:
Performance Evaluation: Provides assessment of an asset's performance, considering both returns and risk factors.
Risk Comparison: Allows for comparing the risk-adjusted returns of different assets or portfolios. Helps identify investments with better risk-reward trade-offs.
Risk Management: Assists in managing risk exposure by evaluating downside risks and volatility.
Statistics
Monthly Gain in percentageThis scripts calculates the percentage gain in a month (previous 22 trade days).
Firstly, it calculates number of sample days
-> minimum no. of sampling duration = 22
-> maximum no. of sampling duration = increased from 22 until 0day_low > 22_day_high
Example if sampling_duration = 100
Monthly percentage gain = ((Current_Day_High_Price - 0_Day_Low_Price) * 100 / 0_Day_Low_Price) * 22 / sampling_duration
Monthly Strategy Performance TableWhat Is This?
This script code adds a Monthly Strategy Performance Table to your Pine Script strategy scripts so you can see a month-by-month and year-by-year breakdown of your P&L as a percentage of your account balance.
The table is based on realized equity rather than open equity, so it only updates the metrics when a trade is closed.
That's why some numbers will not match the Strategy Tester metrics (such as max drawdown), as the Strategy Tester bases metrics like max drawdown on open trade equity and not realized equity (closed trades).
The script is still a work-in-progress, so make sure to read the disclaimer below. But I think it's ready to release the code for others to play around with.
How To Use It
The script code includes one of my strategies as an example strategy. You need to replace my strategy code with your own. To do that just copy the source code below into a blank script, delete lines 11 -> 60 and paste your strategy code in there instead of mine. The script should work with most systems, but make sure to read the disclaimer below.
It works best with a significant amount of historical data, so it may not work very effectively on intraday timeframes as there is a severe limitation of available bars on TradingView. I recommend using it on 4HR timeframes and above, as anything less will produce very little usable data. Having a premium TradingView plan will also help boost the number of available bars.
You can hover your mouse over a table cell to get more information in the form of tooltips (such as the Long and Short win rate if you hover over your total return cell).
Credit
The code in this script is based on open-source code originally written by QuantNomad, I've made significant changes and additions to the original script but all credit for the idea and especially the display table code goes to them - I just built on top of it:
Why Did I Make This?
None of this is trading or investment advice, just my personal opinion based on my experience as a trader and systems developer these past 6+ years:
The TradingView Strategy Tester is severely limited in some important ways. And unless you use complex Excel formulas on exported test data, you can't see a granular perspective of your system's historical performance.
There is much more to creating profitable and tradeable systems than developing a strategy with a good win rate and a good return with a reasonable drawdown.
Some additional questions we need to ask ourselves are:
What did the system's worst drawdown look like?
How long did it last?
How often do drawdowns occur, and how quickly are they typically recovered?
How often do we have a break-even or losing month or year?
What is our expected compounded annual growth rate, and how does that growth rate compare to our max drawdown?
And many more questions that are too long to list and take a lifetime of trading experience to answer.
Without answering these kinds of questions, we run the risk of developing systems that look good on paper, but when it comes to live trading, we are uncomfortable or incapable of enduring the system's granular characteristics.
This Monthly Performance Table script code is intended to help bridge some of that gap with the Strategy Tester's limited default performance data.
Disclaimer
I've done my best to ensure the numbers this code outputs are accurate, and according to my testing with my personal strategy scripts it appears to work fine. But there is always a good chance I've missed something, or that this code will not work with your particular system.
The majority of my TradingView systems are extremely simple single-target systems that operate on a closed-candle basis to minimize many of the data reliability issues with the Strategy Tester, so I was unable to do much testing with multiple targets and pyramiding etc.
I've included a Debug option in the script that will display important data and information on a label each time a trade is closed. I recommend using the Debug option to confirm that the numbers you see in the table are accurate and match what your strategy is actually doing.
Always do your own due diligence, verify all claims as best you can, and never take anyone's word for anything.
Take care, and best of luck with your trading :)
Kind regards,
Matt.
PS. If you're interested in learning how this script works, I have a free hour-long video lesson breaking down the source code - just check out the links below this script or in my profile.
[Mad] Liquidation LevelsThe Liquidation Lines Technical Indicator is a trading tool designed to assist traders in identifying potential liquidation levels. This indicator generates virtual positions, known as "liquidation lines", which mark the points at which these positions would be liquidated under specified conditions.
Key Features:
Quantity of Lines: The indicator can create up to 125 liquidation lines, evenly distributed between long and short positions. This limit is derived from a maximum of 500 lines, divided by four to account for two types of leverage (long and short).
Customizable Liquidation Levels: Users are given the ability to set liquidation levels according to their individual trading strategies and the current market conditions.
Customizable Visuals: The color and thickness of the liquidation lines can be adjusted to suit personal preferences, providing a clear visual representation on the trading chart for ease of analysis.
Selectable Signal Sources: The indicator provides the flexibility to choose the signal source for creating the liquidation lines. Users can select from a range of popular technical analysis tools such as Bollinger Bands, MACD crosses, EMA crosses, or SMA crosses. This feature allows traders to customize the formation of liquidation lines based on their preferred technical indicators, adding to the comprehensiveness and versatility of the tool.
Two selectable Leverages: The indicator accommodates both long and short leverages, offering a comprehensive understanding of potential liquidation points for various trading scenarios.
Selectable Exchange Maintenance: The indicator allows users to select their specific cryptocurrency exchange. This feature ensures that the liquidation lines are accurately calculated according to the maintenance margin requirements of the chosen exchange, adding precision and customization to the trading analysis.
Ultimate Correlation CoefficientIt contains the Correlations for SP:SPX , TVC:DXY , CURRENCYCOM:GOLD , TVC:US10Y and TVC:VIX and is intended for INDEX:BTCUSD , but works fine for most other charts as well.
Don't worry about the colored mess, what you want is to export your chart ->
TradingView: How can I export chart data?
and then use the last line in the csv file to copy your values into a correlation table.
Order is:
SPX
DXY
GOLD
US10Y
VIX
Your last exported line should look like this:
2023-05-25T02:00:00+02:00 26329.56 26389.12 25873.34 26184.07 0 0.255895534 -0.177543633 0.011944815 0.613678565 0.387705043 0.696003298 0.566425278 0.877838156 0.721872645 0 -0.593674719 -0.839538073 -0.662553817 -0.873684242 -0.695764534 -0.682759656 -0.54393749 -0.858188808 -0.498548691 0 0.416552489 0.424444345 0.387084882 0.887054782 0.869918437 0.88455388 0.694720993 0.192263269 -0.138439783 0 -0.39773255 -0.679121698 -0.429927048 -0.780313396 -0.661460134 -0.346525721 -0.270364046 -0.877208139 -0.367313687 0 -0.615415111 -0.226501775 -0.094827955 -0.475553396 -0.408924242 -0.521943234 -0.426649404 -0.266035908 -0.424316191
The zeros are thought as a demarcation for ease of application :
2023-05-25T02:00:00+02:00 26329.56 26389.12 25873.34 26184.07 0 -> unused
// 15D 30D 60D 90D 120D 180D 360D 600D 1000D
0.255895534 -0.177543633 0.011944815 0.613678565 0.387705043 0.696003298 0.566425278 0.877838156 0.721872645 -> SPX
0
-0.593674719 -0.839538073 -0.662553817 -0.873684242 -0.695764534 -0.682759656 -0.54393749 -0.858188808 -0.498548691 -> DXY
0
0.416552489 0.424444345 0.387084882 0.887054782 0.869918437 0.88455388 0.694720993 0.192263269 -0.138439783 -> GOLD
0
-0.39773255 -0.679121698 -0.429927048 -0.780313396 -0.661460134 -0.346525721 -0.270364046 -0.877208139 -0.367313687 -> US10Y
0
-0.615415111 -0.226501775 -0.094827955 -0.475553396 -0.408924242 -0.521943234 -0.426649404 -0.266035908 -0.424316191 -> VIX
KernelFunctionsFiltersLibrary "KernelFunctionsFilters"
This library provides filters for non-repainting kernel functions for Nadaraya-Watson estimator implementations made by @jdehorty. Filters include a smoothing formula and zero lag formula. You can find examples in the code. For more information check out the original library KernelFunctions.
rationalQuadratic(_src, _lookback, _relativeWeight, startAtBar, _filter)
Parameters:
_src (float)
_lookback (simple int)
_relativeWeight (simple float)
startAtBar (simple int)
_filter (simple string)
gaussian(_src, _lookback, startAtBar, _filter)
Parameters:
_src (float)
_lookback (simple int)
startAtBar (simple int)
_filter (simple string)
periodic(_src, _lookback, _period, startAtBar, _filter)
Parameters:
_src (float)
_lookback (simple int)
_period (simple int)
startAtBar (simple int)
_filter (simple string)
locallyPeriodic(_src, _lookback, _period, startAtBar, _filter)
Parameters:
_src (float)
_lookback (simple int)
_period (simple int)
startAtBar (simple int)
_filter (simple string)
j(line1, line2)
Parameters:
line1 (float)
line2 (float)
Source CorrelationIn this small indicator I make it possible for the user to set two different input sources. Then, the indicator displays the correlation of these two input sources. It's a very small script, but I think it could be helpful to somebody to find uncorrelated indicators for his trading strategy. To use uncorrelated indicators is in general recommended.
Enjoy this small, but powerful tool. 🧙♂️
ATR Daily BandThis indicator draws an upper and lower band for each day. It uses the Average True Range calculation (with configurable lookback) and places the band at 1ATR above and 1ATR below the daily open.
I use this indicator as a simple gauge to tell how significant price movement is, and get a feel for the daily volatility. Due to the fractal nature of price action, it can be difficult to determine if a price movement is significant while zoomed in on a single intraday chart. Using this indicator, I can tell if the price action is approaching the ATR or if it's just staying within the band.
Strategies: Useful for both mean reversion and momentum strategies. It's up to you to decide how this metric will fit into your trading strategy. I currently use this indicator to look for mean reversion setups, but that is due to the current market conditions and my personal trading style.
High/Low Statistics @joshuuuThis indicator has been made to get a statistical edge. It has two different options. Weekly High/Low or Daily High/Low
Weekly High/Low - use this on Daily Chart
This option plots a table, that shows how often the High/Low of the Week has been made on certain Days of the Week. It is possible, to only filter bullish/bearish weeks, to have more precise values.
Daily High/Low - use this on Hourly Chart
This options plots a table, that shows how often High/Low of the Day has been made on certain Hours of the Day. It is possible, to only filter bullish/bearish days, to have more precise values.
How do I use it?
Let's say you have created a daily bias. You are expecting spx500 to have a bullish day. Now you can filter bullish days in your indicator settings and then you get data, on which time of the day you have the highest chance to see the high/low of the day being created, same goes for weekly bias.
Initial Balance Panel Strategy for BitcoinInitial Balance Strategy
Initial Balance Strategy uses a source code of "Initial Balance Monitoring Panel" that build from "Initial Balance Markets Time Zones - Overall Highest and Lowest".
Initial Balance is based on the highest and lowest price action within the first 60 minutes of trading. Reading online this can depict which way the market can trend for the session. More information about Initial Balance Panel you can read at the end of the article.
Strategy idea
The main idea is to catch the trend move when most of the 16 Crypto pairs break the Low or High levels together. I found good results when 15 of 16 pairs is break that levels and after we manage the trade within some trail stop indicator, I choose Volatility Stop for this strategy.
Additional Strategy idea
The second one idea that was not made is to catch the pullback after fully green/red zones in Initial Balance Panel become white. That mean the main trend can be finished and we can try to catch good pullback in opposite direction.
Binance Crypto pairs
The strategy use the 16 default Crypto currencies pairs from the Binance. As additional variations of the strategy can be changing the currencies pairs and their number.
List of default pairs:
BINANCE:BTCUSDT, BINANCE:ETHUSDT, BINANCE:EOSUSDT, BINANCE:LTCUSDT, BINANCE:XRPUSDT, BINANCE:DASHUSDT, BINANCE:IOTAUSDT, BINANCE:NEOUSDT, BINANCE:QTUMUSDT, BINANCE:XMRUSDT, BINANCE:ZECUSDT, BINANCE:ETCUSDT, BINANCE:ADAUSDT, BINANCE:XTZUSDT, BINANCE:LINKUSDT, BINANCE:DOTUSDT
Summary
The strategy works very well for a buy trades with settings 15 crypto pairs of 16 that follow the trend with breaking the long initial balance level.
Initial Balance Monitoring Panel
Allows you to have an instant view of 16 Crypto pairs within a monitoring panel, monitoring Initial Balance (Asia, London, New York Stock Exchanges).
The code can easily be changed to suit the crypto pairs you are trading.
The setup of my chart would also include this indicator and the "Initial Balance Markets Time Zones - Overall Highest and Lowest" (with all IBs enabled) as shown above.
Initial Balance is based on the highest and lowest price action within the first 60 minutes of trading. Reading online this can depict which way the market can trend for the session.
The indicator has been coded for Crypto (so other symbols may not work as expected).
Though Initial Balance is based off the first 60 minutes of the trading markets opening, but Crypto is 24/7, this indicator looks at how Asia, London and New York Stock Exchanges opening trading can affect Crypto price action.
Source: Initial Balance Monitoring Panel
Premium MTF Layered RSI - Bitcoin Bot [wbburgin]This the premium version of my MTF Layered RSI strategy, which improves significantly on the original strategy (publicly available on my profile). Improvements are below. This strategy will also appear as an overlay on your chart. It is completely non-repainting.
The MTF Layered RSI strategy uses the current timeframe and two configurable higher timeframes to enter a long position when Bitcoin is oversold on all three timeframes, and exit the long position when Bitcoin is overbought on the current timeframe. This hedges against situations where the RSI on higher timeframes never reaches the overbought level and we are left "holding the bag" so to speak with the classic "enter long at oversold and enter short at overbought" strategy.
IMPORTANT: This strategy does not work on ranges. It will work on all timeframes and assets, but does not work on ranges (Renko blocks and some other advanced types of charts).
********** My Background
I am an investor, trader, and entrepreneur with 10 years of cryptocurrency and equity trading experience and founder of two fintech startups. I am a graduate of a prestigious university in the United States and carry broad and inclusive interests in mathematical finance, computer science, machine learning / artificial intelligence, as well as other fields.
**********
Improvements over the original MTF RSI strategy include:
Filters for Uptrends and Downtrends → The Premium RSI strategy will adjust its buy and sell thresholds depending on whether the instrument is trending. This means that, in uptrends, the Premium strategy will buy more frequently, bringing in potentially greater profit, and in downtrends, the strategy will stop buying altogether. These filters and dynamic buy/sell thresholds have made this strategy more profitable in my backtesting across random timeframes, but I cannot guarantee that the strategy will be profitable for you on the default settings. To that end, I have enabled a number of different configurations that you can change in the settings of the strategy.
Stop Loss / Take Profit Calculation Per Tick → Stop loss and take profit are now both enabled in the script and each has their own alerts. You can specify what type of stop loss or take profit you want: percentage or ATR. If you have alerts configured, you will be alerted mid-bar, instead of at close. This helps prevent loss from abrupt falls in price between closing price and next bar open.
Customizable Alert Messages In-Strategy → In the settings, there will be text boxes where you can create your own alerts. All you will need to do is create an alert in the alert panel on Tradingview and leave the message box blank - if you fill out the alert boxes in the settings, these will automatically populate into your alerts. There are in total eight different customizable alerts messages: Entry, Exit, Stop loss, and Take profit alerts for both Long and Short sides. If you disable stop loss and/or take profit, these alerts will also be disabled. Similarly, if you disable shorts, all short alerts will be disabled.
**********
Display
Configuring Stop Loss or Take Profit will make their corresponding displays appear.
Separately from the trading boxes, background colors (green, red) signify extended uptrends and downtrends, respectively.
Configuring Alerts
In TradingView desktop, go to the ‘Alerts’ tab on the right panel. Click the “+” button to create a new alert. Select this strategy for the condition and one of the two options that includes alert() function calls. Name the alert what you wish and clear the default message, because your text in the settings will replace this message.
Now that the alert is configured, you can go to the settings of the strategy and fill in your chosen text for the specific alert condition. You will need to check “Long and Short” in the “Trade Direction” setting in order for any Short Alerts to become active. Similarly, you will need to check “Enable Stop Loss” for stop loss alerts to become active and “Enable Take Profit” for take profit alerts to become active.
**********
Disclaimer
Copyright by wbburgin.
The information contained in my Scripts/Indicators/Algorithms does not constitute financial advice or a solicitation to buy or sell any securities of any type. I will not accept liability for any loss or damage, including without limitation any loss of profit, which may arise directly or indirectly from the use of or reliance on such information.
All investments involve risk, and the past performance of a security, industry, sector, market, financial product, trading strategy, backtest, or individual's trading does not guarantee future results or returns. Investors are fully responsible for any investment decisions they make. Such decisions should be based solely on an evaluation of their financial circumstances, investment objectives, risk tolerance, and liquidity needs.
**********
Notes on the Strategy Performance below: This is 3% of equity per trade, with a pyramiding number of 3. I did not include fees because Binance US on Bitcoin/USD does not charge fees on the instrument; however, I heavily encourage you to include fees in your backtesting if you use a different brokerage. To mitigate fees, this strategy is designed with a high average %/trade. If your current fees are greater than the strategy's average %/trade, I encourage you to choose a higher RSI period, such as 14 or 28, which will result in less trades but potentially a higher %/trade.
Position and Profit/LossHelps users track their position and profit/loss in real-time.
Instructions :
Open the indicator settings
Input your Quantity, Buy Price, Fee, and Target Price
This indicator is designed to provide users with simple real-time tracking of their positions and profit/loss within a trading session. It offers clear and concise information that enables users to understand their current position's profitability, making it easier for them to manage their trades effectively.
Input parameters
qty : Quantity of the position (default value: 100.0). The target label is represented by a green cross
buy_price : Buy price of the position (default value: 1.0).
fee : Fee percentage for the transaction (default value: 0.0016). note that this is not a percentage, but rather a decimal. So 0.0016 is 0.16%
target : Target price for the position (default value: 1.0). This is an extra label to show you where your target is on the chart. The target label is represented by a green cross
In addition to the main profit/loss label, the script also displays two auxiliary labels. The "BuyPrice" label presents the buy price of the position as a red cross symbol on the chart, allowing users to easily identify their entry point. The "targetSell" label displays the target sell price as green cross symbol, indicating the desired exit point for the position. These visual markers help users visualize their trading strategy.
The script takes into account that users may only need this information displayed on the last bar, as continuous updates might not be necessary. By checking if the current bar is the last one, the script ensures that the labels are only displayed when relevant.
Limitations
The script assumes that trading is done using the same quantity; which is not always the case. This will change with subsequent updates.
Opal - Aggr.Crypto█ OVERVIEW
The Multi-Exchange Crypto Aggregator is a unique concept ticker that gathers up to 10 tickers into one. A new OPAL Chart is created as an indicator, with its own candles and information. This information is meant to be interpreted as average information in order to reduce noise from a single ticker only. Everything is automated between assets. Our script will always check and ensure that data is received for calculations; otherwise, invalid tickers are ignored. This version is designed for Crypto Perpetual markets.
█ HOW DATA SLIPPAGE/DIFFERENCE IMPACT NOISE
This new average ticker aims to reduce noise in your candles and their live movements, avoiding most of the minor/last-second spikes, especially when they don't happen on every desired exchange at the same time. Our candles have different behaviors and highlight close-open slippage/gaps, as it seems to provide a strong reaction. Those gaps represent average slippage.
█ HOW TO USE
This should help you visualize market behaviors. Volume pressures are the origin of a lot of misunderstood things. Data analysis and observations show that makers target liquidity on both sides. Time and sessions have their own logic and will always need experience, as it is basically a gigantic Tetris game. Anyway, this should help with timing confirmations or bring confidence.
█ FEATURES
Aggregated (Tickers) Candles ▸ Aggregated OHLC candles, the idea behind the script. Set desired tickers to automate in settings. Value and Var% are displayed right next to the current candle.
Aggr. Dynamics/Levels ▸ Plot some strong levels as landmarks calculated on modified price, from Volume Weighted Average Price (VWAP) to Daily aggregated Open Price. The previous day's key level is included.
Aggr. Data Markers ▸ Plot some key markers on the chart, such as Open Pressure gaps, or estimated 3-scale liquidation bubbles with 2 confirmation modes (using different filters).
Aggr. Averages ▸ Plot up to 3 averages or HLC channels for visual ease.
█ SIGN
All of our contents are shared for educational purposes only.
Wishing you success;
OPAL - Strive for Greatness
Statistics TableThis script display some useful Statistics data that can be useful in making trading decision.
Here the list of information this script is display in table format.
You can change each and every single ema and rs length as per your need from setting.
1) close difference from first ema
2) close difference from second ema
3) close difference from third ema
4) close difference from fourth ema
5) difference between first and second ema
6) difference between second and third ema
7) difference between first and third ema
8) volume up down ratio
9) ATR/ADR %
10) volume pocket pivot count
11) daily closing range
12) weekly closing range
13) close difference from 52week high
14) close difference from 52week low
15) close difference from All time high
16) close difference from All time low
17) rs line above or below first rs ema
18) rs line above or below second rs ema
19) rs line above or below third rs ema
20) rs line above or below fourth rs ema
21) first rs value
22) second rs value
23) third rs value
24) fourth rs value
25) difference between previous first rs length days change % and current first rs length days change %
26) difference between previous second rs length days change % and current second rs length days change %
27) difference between previous third rs length days change % and current third rs length days change %
Time Series Model IndicatorHello,
I am releasing this time series modelling indicator.
Brief overview of the indicator's functionality:
The Time Series Model indicator is a technical analysis tool that calculates and visualizes a linear regression line based on historical price data. It assesses the trend direction and provides an outer band around the regression line to indicate potential support and resistance levels. The indicator also detects outliers in the price data and calculates correlations between the time variable and the closing price. It offers various customization options such as input length, user-defined hours in advance, display settings for tables and fills, and the ability to show variable correlations. Overall, this indicator aims to help traders identify trends, potential reversals, and price extremes in a given time series.
Specific Functions:
Slope Calculations: The indicator calculates the slope and intercept of the regression line using the specified length of assessment (user defined). It also computes the residuals, standard error of the regression, and the upper and lower bounds of the standard error region. Additionally, it calculates multiple standard deviation bands around the regression line. The slope will change to green if the stock is in an uptrend and to red if the stock is in a downtrend.
Outliers: This feature detects extreme positive and negative outliers based on the z-score calculated from the price data. It highlights the outliers with a red background color to red if this option is selected.
Correlation to Time Assessments: This feature performs trend assessments based on the correlation between time and price data. It identifies uptrends, downtrends, falling trends, rising trends, etc.
Outerband Plots: This feature plots the regression line, standard error bands, and multiple standard deviation bands around the regression line. It also fills the areas between these lines.
Trend Assessment: This feature further assesses the trend based on the strength of the correlation. It identifies strong up or down trends, moderate trends, weak trends, no trend, etc.
Linear Regression Time Data: This section retrieves price data (close, high, low, open) for the specified timeframe and stores them in arrays for a linear regression analysis.
Define LinReg Variables: This section calculates linear regression lines and their upper and lower control limits for the close, low and high prices. It also calculates the correlation between close price and time.
Manual assessments: This feature allows for the manual assessment of time series data. The user can input a look forward for hours in the future and get the predicted price range based on the current time relationship. See image below:
Calculating model "fit": The indicator will display the amount of time the stock closes within and outside its respective bands to ascertain the degree of "fit" (see image below):
Explanations:
The outer cloud: The outer, tealish green cloud represents the regression line + 1.5 standard deviations from the regression line.
The inner cloud: The inner, white coloured cloud represents the immediate time series range calculated through regression of the open, high and low price of the ticker.
Correlations:
The ability of the indicator to calculate correlations on both the smaller and larger timeframes are its strongest feature. You can see the formation of trends by tracking the correlation over the length of the time series model's assessment. You can also track the degree of change. The image below shows the correlation table:
In this image, we can see that the stock is in a moderate downtrend manifested by a correlation of -0.73 (purple arrow).
This downtrend is weakening as manifested by a positive change of 0.05 on the shorter timeframe.
If we scroll down on the table and see the Close, High and Low, we can see that the larger trend over time is a downtrend and that this downtrend is actually strengthening. We know this by the negative change (negative change = significant inverse relationship to time is increasing. i.e. as time increases, the stock price decreases proportionately).
So what does negative correlation to time mean?
If a stock's price exhibits a negative correlation to time, it implies that there is a systematic relationship between the passage of time and the stock's price movement in the opposite direction. This finding could have several potential implications for traders and investors. Firstly, it suggests that the stock's price tends to decrease as time progresses, indicating a downward trend or bearish sentiment. This information might be useful for traders looking to capitalize on short-selling or hedging strategies. Secondly, it could indicate a potential opportunity to predict future price movements based on the timing of negative correlations. By understanding the relationship between time and price, investors may be able to make more informed decisions about when to buy or sell the stock. Lastly, a negative correlation to time may also suggest the influence of external factors or market conditions that systematically impact the stock's performance over time. Therefore, monitoring this correlation can provide insights into broader market dynamics and help investors better understand the stock's behavior.
What about a positive correlation to time?
If a stock's price demonstrates a positive correlation to time, it means that there is a consistent relationship between the passage of time and the stock's price movement in the same direction. This positive correlation to time can have significant implications for traders and investors. Firstly, it indicates a potential upward trend or bullish sentiment, suggesting that the stock's price tends to increase as time progresses. This information can be valuable for investors seeking long-term growth opportunities or looking to capitalize on upward price movements. Secondly, a positive correlation to time may provide insights into the stock's historical performance patterns and help identify potential buying or selling opportunities based on the timing of positive correlations. Additionally, understanding this correlation can aid in assessing the stock's overall trajectory and identifying potential market trends. It's important to note that positive correlation to time does not guarantee future performance, but it can offer valuable information to inform investment decisions.
Because this indicator is pretty big, I have done an overview and tutorial video which I will link below:
As always, please leave your comments and suggestions below.
I thank you for taking the time to read and check out this indicator.
Safe trades everyone and enjoy your weekend!
Cobra's CryptoMarket VisualizerCobra's Crypto Market Screener is designed to provide a comprehensive overview of the top 40 marketcap cryptocurrencies in a table\heatmap format. This indicator incorporates essential metrics such as Beta, Alpha, Sharpe Ratio, Sortino Ratio, Omega Ratio, Z-Score, and Average Daily Range (ADR). The table utilizes cell coloring resembling a heatmap, allowing for quick visual analysis and comparison of multiple cryptocurrencies.
The indicator also includes a shortened explanation tooltip of each metric when hovering over it's respected cell. I shall elaborate on each here for anyone interested.
Metric Descriptions:
1. Beta: measures the sensitivity of an asset's returns to the overall market returns. It indicates how much the asset's price is likely to move in relation to a benchmark index. A beta of 1 suggests the asset moves in line with the market, while a beta greater than 1 implies the asset is more volatile, and a beta less than 1 suggests lower volatility.
2. Alpha: is a measure of the excess return generated by an investment compared to its expected return, given its risk (as indicated by its beta). It assesses the performance of an investment after adjusting for market risk. Positive alpha indicates outperformance, while negative alpha suggests underperformance.
3. Sharpe Ratio: measures the risk-adjusted return of an investment or portfolio. It evaluates the excess return earned per unit of risk taken. A higher Sharpe ratio indicates better risk-adjusted performance, as it reflects a higher return for each unit of volatility or risk.
4. Sortino Ratio: is a risk-adjusted measure similar to the Sharpe ratio but focuses only on downside risk. It considers the excess return per unit of downside volatility. The Sortino ratio emphasizes the risk associated with below-target returns and is particularly useful for assessing investments with asymmetric risk profiles.
5. Omega Ratio: measures the ratio of the cumulative average positive returns to the cumulative average negative returns. It assesses the reward-to-risk ratio by considering both upside and downside performance. A higher Omega ratio indicates a higher reward relative to the risk taken.
6. Z-Score: is a statistical measure that represents the number of standard deviations a data point is from the mean of a dataset. In finance, the Z-score is commonly used to assess the financial health or risk of a company. It quantifies the distance of a company's financial ratios from the average and provides insight into its relative position.
7. Average Daily Range: ADR represents the average range of price movement of an asset during a trading day. It measures the average difference between the high and low prices over a specific period. Traders use ADR to gauge the potential price range within which an asset might fluctuate during a typical trading session.
Utility:
Comprehensive Overview: The indicator allows for monitoring up to 40 cryptocurrencies simultaneously, providing a consolidated view of essential metrics in a single table.
Efficient Comparison: The heatmap-like coloring of the cells enables easy visual comparison of different cryptocurrencies, helping identify relative strengths and weaknesses.
Risk Assessment: Metrics such as Beta, Alpha, Sharpe Ratio, Sortino Ratio, and Omega Ratio offer insights into the risk associated with each cryptocurrency, aiding risk assessment and portfolio management decisions.
Performance Evaluation: The Alpha, Sharpe Ratio, and Sortino Ratio provide measures of a cryptocurrency's performance adjusted for risk. This helps assess investment performance over time and across different assets.
Market Analysis: By considering the Z-Score and Average Daily Range (ADR), traders can evaluate the financial health and potential price volatility of cryptocurrencies, aiding in trade selection and risk management.
Features:
Reference period optimization, alpha and ADR in particular
Source calculation
Table sizing and positioning options to fit the user's screen size.
Tooltips
Important Notes -
1. The Sharpe, Sortino and Omega ratios cell coloring threshold might be subjective, I did the best I can to gauge the median value of each to provide more accurate coloring sentiment, it may change in the future.
The median values are : Sharpe -1, Sortino - 1.5, Omega - 20.
2. Limitations - Some cryptos have a Z-Score value of NaN due to their short lifetime, I tried to overcome this issue as with the rest of the metrics as best I can. Moreover, it limits the time horizon for replay mode to somewhere around Q3 of 2021 and that's with using the split option of the top half, to remain with the older cryptos.
3. For the beginner Pine enthusiasts, I recommend scimming through the script as it serves as a prime example of using key features, to name a few : Arrays, User Defined Functions, User Defined Types, For loops, Switches and Tables.
4. Beta and Alpha's benchmark instrument is BTC, due to cryptos volatility I saw no reason to use SPY or any other asset for that matter.
VISION 1.0Introducing the VISION Indicator:
The VISION Indicator is an advanced tool that empowers users to analyze and predict market trends by utilizing three distinct boxes: Box A, Box B, and Box C. Each box represents a specific time range, allowing users to customize their analysis based on their preferred intervals.
Located at the top panel of the indicator, users can easily identify which boxes have a higher likelihood of representing the high or low points of the day. This information assists traders in focusing their attention on the specific boxes that are more likely to contain significant market turning points.
To provide additional insights, the indicator incorporates color-coded panels on the right side. These panels enhance the usability of the indicator by offering valuable information on accuracy and volume characteristics.
The red panel indicates the most accurate predictions for the low of the day. By examining this panel, traders can quickly determine which box historically demonstrates a higher probability of correctly predicting the market's lowest points.
Similarly, the green panel highlights the most accurate predictions for the high of the day. This panel provides traders with a visual representation of which box has historically shown a higher probability of correctly predicting the market's highest points.
Additionally, the blue panel showcases the box with the highest volume percentage. Traders can leverage this information to gauge the intensity of trading activity within different time intervals. By understanding volume patterns, traders can make informed decisions about optimal entry and exit points.
Overall, the VISION Indicator offers a comprehensive visual representation of different time intervals and their respective probabilities for market highs, lows, and trading volume. With this valuable tool, traders can gain insights into potential market trends and make informed trading decisions based on historical patterns and volume analysis.
Autoregressive CloudHello,
I am releasing this indicator called the Autoregressive Cloud Indicator.
What it does:
The indicator performs an autoregression analysis on 3 price variables of a ticker, those being the High, the Low and the Close. It uses a 1-lag system and looks back at the previous close, high and low’s effect on the proceeding high, low and close. It then plots out the anticipated range for the ticker based on the autoregression analysis, as well as displays the lag-correlation (autocorrelation) in a table.
What is Autoregression analysis?
Autoregression is a modelling technique used to describe a time series based on its own past values. It assumes that the current value of a variable is a linear combination of its previous values and a random error term.
And what is autocorrelation?
Autocorrelation measures the correlation between a time series and its lagged values. It quantifies the degree to which the current value of a series is related to its past values at different lags, indicating any patterns or dependencies in the data over time. Autoregression and autocorrelation are closely related concepts used to analyze and model time series data.
So how does it work?
The indicator calculates autoregressive values for the close, high, and low prices of a security based on the specified lookback length (which is defaulted to 50). It then plots three sets of clouds representing the smoothed autoregressive values for each price component (done using the SMA function). The transparency of the clouds can be adjusted using the "Transparency" input. Additionally, the code includes a correlation table that displays the correlation coefficients between the lagged values of the close, high, and low prices. The table's position can be customized using the "Position" input.
The indicator defaults to the chart timeframe; however, you can manually adjust the indicator to display the range for whatever timeframe you would like. You can view the 30 minute, 15 or even hourly range on the 1 minute or 5 minute chart if you want.
The indicator will show the anticipated “true trading range” of the stock based on the autoregression and autocorrelation of all 3 variables:
Above is SPY on the 5 minute timeframe with 15 minute levels overlayed. Here, you can see the anticipated trading range for that 15 minute time period.
Using the Correlation Table:
The correlation table displays the Pearson Coefficient for all 3 autoregressions.
A positive correlation: A positive autocorrelation indicates a positive relationship between past and current values of a time series variable. It suggests that when the variable has a high value at a certain time, it is more likely to have a high value in the future, and when it has a low value, it is more likely to have a low value in the future. This positive autocorrelation can imply persistence or trend in the data, indicating that past values can provide useful information for predicting future values. The rule of thumb is anything over 0.5 is considered significant.
A positive correlation among all 3 variables also indicates an uptrend. If you see a strong positive (i.e. the values are all greater than 0.8), it indicates an incredibly decisive and strong uptrend.
A negative correlation: A negative autocorrelation indicates an inverse relationship between past and current values of a time series variable. It suggests that when the variable has a high value at a certain time, it is more likely to have a low value in the future, and vice versa. This negative autocorrelation can imply mean reversion or oscillatory behavior in the data, where extreme values tend to be followed by values closer to the average. It indicates that past values can provide useful information for predicting future values by anticipating a reversal in the direction of the variable. The rule of thumb is anything below or equal to -0.5 is considered significant.
A negative correlation among all 3 variables also indicates a downtrend. If you see a strong negative (i.e. the values are all less than or equal to -0.8), it indicates an incredibly decisive and strong downtrend.
Uses of the Indicator:
The indicator can be used for the following functions:
1. Day trading and scalping within an expected range;
2. Determining the strength or weakness of an uptrend or downtrend on various timeframes;
3. Determining the relationship between previous values and past performance and its effect on future performance;
4. Can alert to changes in trend direction in advance (you may see high, low or close turn negative before others, signifying that weakness is beginning to materialize in an uptrend, or inverse in a downtrend (value changes positive)).
Customizability:
SMA: The autoregression data is smoothed by a 3 period lookback. You can change this if you want, but in order for the indicator to present the true trading range, it is recommended to leave it at <= 3.
Lookback Length: This is the length of the lookback period for the autoregression and autocorrelation functions.
Transparency settings: You can adjust the transparency of the clouds manually.
Timeframe: You can adjust the timeframe, as explained above, to display the timeframe of interest. When you adjust the timeframe, the data will all reflect that timeframe and not necessarily the current TF you have open (i.e. you select 30 minutes while viewing it on the 5 minute, it will show the data for the 30 minute TF period).
Video Tutorial:
I have prepared a video outlining the indicator and also explaining the theory of autoregression/correlation. You can find it below:
Let me know any comments, questions or suggestions below.
Thank you for taking the time to read/watch and check out this indicator.
Safe trades everyone!
MTF Stationary Extreme IndicatorThe Multiple Timeframe Stationary Extreme Indicator is designed to help traders identify extreme price movements across different timeframes. By analyzing extremes in price action, this indicator aims to provide valuable insights into potential overbought and oversold conditions, offering opportunities for trading decisions.
The indicator operates by calculating the difference between the latest high/low and the high/low a specified number of periods back. This difference is expressed as a percentage, allowing for easy comparison and interpretation. Positive values indicate an increase in the extreme, while negative values suggest a decrease.
One of the unique features of this indicator is its ability to incorporate multiple timeframes. Traders can choose a higher timeframe to analyze alongside the current timeframe, providing a broader perspective on market dynamics. This feature enables a comprehensive assessment of extreme price movements, considering both short-term and longer-term trends.
By observing extreme movements on different timeframes, traders can gain deeper insights into market conditions. This can help in identifying potential areas of confluence or divergence, supporting more informed trading decisions. For example, when extreme movements align across multiple timeframes, it may indicate a higher probability of a significant price reversal or continuation.
To use the Multiple Timeframe Stationary Extreme Indicator effectively, traders should consider a few key points:
- Choose the Timeframes : Select the appropriate timeframes based on your trading strategy and objectives. The current timeframe represents the focus of your analysis, while the higher timeframe provides a broader context. Ensure the chosen timeframes align with your trading style and the asset you are trading.
- Interpret Extreme Movements : Pay attention to extreme movements that breach certain levels. Values above zero indicate a rise in the extreme, potentially signaling overbought conditions. Conversely, values below zero suggest a decrease, potentially indicating oversold conditions. Use these extreme movements as potential entry or exit signals, in conjunction with other indicators or confirmation signals.
- Validate with Price Action : Confirm the extreme movements observed on the indicator with price action. Look for confluence between the indicator's extreme levels and key support or resistance levels, trendlines, or chart patterns. This can provide added confirmation and increase the reliability of the signals generated by the indicator.
- Consider Volatility Filters : The indicator can be enhanced by incorporating volatility filters. By adjusting the sensitivity of the extreme differences calculation based on market volatility, traders can adapt the indicator to different market conditions. Higher volatility may require a longer lookback period, while lower volatility may call for a shorter one. Experiment with volatility filters to fine-tune the indicator's performance.
- Combine with Other Analysis Techniques : The Multiple Timeframe Stationary Extreme Indicator is most effective when used as part of a comprehensive trading strategy. Combine it with other technical analysis tools, such as trend indicators, oscillators, or chart patterns, to form a well-rounded approach. Consider risk management techniques and money management principles to optimize your trading strategy.
---------------------------------------------------------------------------------------------------------------------------------------------------------------
Remember that trading indicators, including the Multiple Timeframe Stationary Extreme Indicator, should not be used in isolation. They serve as tools to assist in decision-making, but they require proper context, analysis, and confirmation. Always conduct thorough analysis and consider market conditions, news events, and other relevant factors before making trading decisions.
It's recommended to backtest the indicator on historical data to assess its performance and effectiveness for your trading approach. This will help you understand its strengths and limitations, allowing you to refine and optimize your usage of the indicator.
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 :)
MA Correlation CoefficientThis script helps you visualize the correlation between the price of an asset and 4 moving averages of your choice. This indicator can help you identify trendy markets as well as trend-shifts.
Disclaimer
Bear in mind that there is always some lag when using Moving-Averages, hence the purpose of this indicator is as a trend identification tool rather than an entry-exit strategy.
Working Principle
The basic idea behind this indicator is the following:
In a trendy market you will find high correlation between price and all kinds of Moving-Averages. This works both ways, no matter bull or bear trend.
In sideways markets you might find a mix of correlations accross timeframes (2018) or high correlation with Low-Timeframe averages and low correlation with High-Timeframe averages (2021/2022).
Trend shifts might be characterised by a 'staircase' type of correlation (yellow), where the asset regains correlation with higher timeframe averages
Indicator Options
1. Source : data used for indicator calculation
1. Correlation Window : size of moving window for correlation calculation
2. Average Type :
Simple-Moving-Average (SMA)
Exponential-Moving-Average (EMA)
Hull-Moving-Average (HMA)
Volume-Weighted-Moving-Average (VWMA)
3. Lookback : number of past candles to calculate average
4. Gradient : modify gradient colors. colors relate to correlation values.
Plot Explanation
The indicator plots, using colors, the correlation of the asset with 4 averages. For every candle, 4 correlation values are generated, corresponding to 4 colors. These 4 colors are stacked one on top of the other generating the patterns explained above. These patterns may help you identify what kind of market you're in.
mrD-Smart RangesmrD-Smart Ranges aims to offer a complete strategy based on Order Blocks. Ranges signals based on order volume are highlighted, from which smart ranges are suggested to provide potential entries.
This script also includes warnings for each signal marked.
🔶 SETTINGS
Pair Strategy: Select the desired from the list. Change the chart to the one specified in the Strategy.
Current TF Order Blocks: Allows the user to select how many most recent Internal Order Blocks appear in the current time frame on the chart.
Order Block Filter: Allows the user to select how the script mitigates an Order Block.
Hide Overlap: Allows the user to display overlapping Order Blocks.
Show Metrics: Allows the user to display volume % metrics within the Order Blocks.
Show Volume Box: Allows the user to display buy/sell activity within Order Blocks.
High Timeframe: Allows the user to choose a higher or lower timeframe to find the Signals.
Show Failed Buy Sell: Allows the user to display the Signals.
Show HTF Box: Allows the user to display a higher or lower timeframe Order Blocks.
🔶 DETAILS
Order blocks are formed after a slight bearish order block, these can provide an opportunity to change polarity, thus acting as a potential support/resistance level.
A retest/retrace on the order block, combined with order volume between the current timeframe and from the higher timeframe will establish the conditions for smart ranges are suggested to provide potential entries.
🔶 USAGE
mrD-Smart Ranges aims to provide users with a minimalistic screen next to the optimal ranges to keep in mind to find trading setups as shown below.
Here we can see a suggested Sell range and display a label to confirm this range
Signal(s) that can be used for potential entries only during range retest are order blocks.
Users can search for more potential entry ranges based on larger timeframes in the settings: High Timeframe
In the image above, we can see that the price has generated potential orange and bearish entry signals. A confirmation signal with a red label is displayed on the chart when the price retests the Sell range.
Note: While range retests can still work well if they occur later in price action, it's best to look for signals only when price retests the range at the outset rather than retesting it. second price.
The logic of generating signal ranges using different rules is described below:
- Define order blocks in the current timeframe.
- Define the order blocks with the largest volume in the current timeframe.
- Define order blocks in larger timeframes in High Timeframe settings
- Define order blocks with the largest volume in larger timeframes in High Timeframe settings
Entry Range: The combination of the highest volume order blocks in the current timeframe and the highest volume order blocks in the larger timeframe.
🔶General disclaimer:
Trading stocks, futures, forex, options, ETFs, cryptocurrency, or any other financial instrument has huge potential rewards and risks.
You must be aware of the risks and willing to accept them to invest in stocks, futures, forex, options, ETFs, or cryptocurrencies.
Don't trade with money you can't afford to lose.
This is not an offer or an offer to Buy/Sell stocks, futures, Forex, options, ETFs, cryptocurrencies, or any other financial instrument.
Do not represent that any account will or is likely to achieve profit or loss of any kind.
The past performance of any trading system or method is not necessarily indicative of future results.
My Scripts/Indicators/Ideas/Algos/Systems are only for educational purposes!
Session KillZones [7Bridges]Session Killzones by 7Bridges indicator display the killzones of asian, LND and NY sessions. There is also a custom session of your choice.
The times of each killzone are GMT time and you can adjust it in the settings.
You have also the beginning of the day, GMT and EST timezones.
By default the killzones are set like that on the GMT/UTC timezone :
-> Asia : 00:00 - 06:00
-> Pre London : 06:00 - 07:00
-> London : 07:00 - 10:00
-> New York : 12:00 - 15:00
-> Custom session : choose your own time
What makes the indicator very different is that the session is not overlapping the price but you have bars below and above the price.
Settings:
-> you can chose to display the Killzones (Asia, pre LND, LND and NY)
-> you can manages the time of the sessions
-> you can chose to display the start of the day (GMT/UTC and EST )
The indicator is displayed by default only for all the timeframes below 60min.