Link to the indicator: https://levia.io/liquidationlevelslink
In this instructional article, I will be discussing my new indicator called Liquidation Levels. For the past year, I have been intensively incorporating derivatives data analysis, order flow, volume and other related concepts into my trading system in order to gain a deeper understanding of market activity beyond simply analyzing price action. This and my recent (bear market) efforts to learn Pine Script inspired me to build an indicator that incorporates some lately very popular concepts such as liquidations and liquidity. I have been using Hyblock’s Liquidation Levels tool for quite some time and decided to challenge myself to build a similar tool on Tradingview based on my own understanding of these concepts (their tool is not open script) and with some of my own modifications and additions. I was aware that it would not be an easy task due to the limited data available in Pine Script, but I gave it a try and was able to create a fairly useful indicator. I guess Hyblock’s tool is still more accurate, especially because they have access to more data but I believe I did a solid job with the resources I had and added some new concepts that are considered useful by myself and early testers of the indicator. If you want to test Hyblock’s platform, you can use my referral link to get 10% discount: hyblockcapital.com/referer/NW9XLL
The job of this indicator is to attempt to predict the liquidation levels of other traders and use this information to add an edge to our own trading decisions. It is not the aim of this article to explain why or how this happens but for one reason or another, price gravitates toward those levels. It is known that the majority of traders are not profitable, particularly when using high leverage. This fact is crucial in understanding the potential usefulness of liquidation levels for our own trading, because if we know that most of the over-leveraged traders will get flushed out, we can play against them. As you probably know, there is no way to see actual liquidation levels or stop loss prices of other traders unless you are an exchange or among a few other entities who have access to such data. As a result, all available liquidation level tools are simply predictions based on various types of data. My script uses open interest (where available), volume, price movements, and a set of “educated guesses” to calculate the potential levels at which over-leveraged traders may be liquidated. Additionally, I have included functionalities beyond simply displaying liquidation lines in order to better visualize and interpret market activity.
As a user of various tools, I have always appreciated when the creators provide the ability to customize the tools to meet my specific needs. That is why this indicator’s settings offer a great deal of flexibility when it comes to modifying parameters, conditions, inputs, and other elements, enabling you to tailor it to fit your system. While it may seem confusing at first, I am confident that this instructional article will help you comprehend and utilize the indicator to its full potential.
Finally, I want to stress that I am not a coder, I’m simply a trader who has been learning and playing around with Pine Script. Therefore, I ask for your patience regarding any potential mistakes or the functioning of this script in general. As my skills improve and we all conduct more thorough testing, the indicator will be modified and enhanced. If you have any questions, feel free to message me on Twitter or send a message to my Telegram/Discord community. The links to both are listed on my Linktree: linktr.ee/leviathancrypto
If you want to support my work, you can consider registering on my partner exchanges Bybit and/or BingX, where I will recieve a small percentage of your trading fees (that would otherwise be paid only to the exchange) and you will get fee deductions, deposit bonuses, trading bonuses, access to trading competitions and more.
It is very important to understand all the settings offered by my indicator before using it, so I will go over them one by one and do my best to explain the concepts. I highly recommend thoroughly reading this article and then experimenting with the script to determine your preferred inputs. The settings consist of Basic Settings, Appearance, Standard Deviation Multipliers and Other Settings.
Primary Source of Data
As I mentioned, I wanted to provide a great deal of flexibility in the indicator settings. This input allows you to choose the primary source of data that the script uses to calculate liquidation levels. I encourage you to test them all and see which works best for the assets and timeframes you trade. You can also regularly switch between to see confluences. My personal favorite inputs (and also most accurate ones) are Open Interest, Open Interest + Volume (OI+VOL), and Open Interest + CVD (OI+CVD), as they utilize Open Interest in the calculations, which is the most important factor when it comes to analyzing position opening/closing and market activity in general. The other options that do not include Open Interest (Volume, CVD) were mainly added to provide the possibility to use the indicator on pairs where OI data is not available. Please note that this indicator is built on Tradingview and can only use data (e.g., Open Interest) provided by Tradingview, which is unfortunately quite limited. This is why I recommend using the script with OI-based data source inputs on Binance’s perpetual futures pairs, as this is where OI data is available. The volume-based data source inputs can be used on spot pairs, forex, indices, and other markets, where Open Interest data is not provided.
To summarize the use of Primary source of data:
- Open Interest – use on Binance’s perpetual futures or anywhere else where OI data is available
- OI + VOL – use on Binance’s perpetual futures or anywhere else where OI data is available
- OI + CVD – use on Binance’s perpetual futures or anywhere else where OI data is available
- CVD – use on any pair you wish
- Volume – use on any pair you wish
If turned on, the Directional bias function uses volume and some other calculations to predict which side’s liquidation levels are more likely to be filled and only keep those levels on your chart.
Directional Bias for Liquidation Levels Turned ON: only one side’s liquidation levels are shown on the chart Turned OFF: all liquidation levels are shown on the chart.
Directional Bias for Liquidation Bubbles Turned ON: only one side’s liquidation level bubbles are shown on the chart Turned OFF: all liquidation bubbles are shown on the chart.
I have separated directional bias options between Liquidation Levels and Liquidation Level Bubbles because sometimes it can be useful to have one of them ON and the other one OFF.
The Reduce Sensitivity option allows you to multiply the thresholds for “Smaller Size Liquidation,” “Medium Size Liquidation,” and “Large Size Liquidation” simultaneously. This is a useful feature as it enables you to easily filter larger positions and their liquidations without having to manually alter the standard deviation multipliers, which will be discussed in further detail later in the article.
The default value is 1, which means that it does nothing.
Increasing it above 1 will increase all thresholds and therefore generate fewer liquidation levels but with larger relative sizes.
Decreasing it below 1 will lower all thresholds and therefore generate more liquidation levels but with both smaller and larger relative sizes.
Similar tools often use candle close as a base for plotting levels. This input gives you the freedom to choose between four different bases, from which the liquidation levels will be generated.
CLOSE ⇒ Levels are plotted above and below the close of the candle
HALF ⇒ Levels are plotted above and below the middle of the candle ((high+low)/2)
VWAP ⇒ Levels are plotted above and below the volume-weighted average price
VWMA ⇒ Levels are plotted above and below the volume-weighted moving average
I suggest that you backtest them and see what works best for you.
Liquidation Level Bubbles
If enabled, “Liquidation Level Bubbles” mark the beginning of a new liquidation level and indicate the relative size of liquidations that would occur if the price were to reach that level.
Liquidation Bubbles or Liquidation Levels in general appear when there is a large influx of new positions and logically, (significant) new positions lead to (significant) new liquidation levels. Liquidation Bubbles can be used to estimate the size and therefore significance of a given liquidation level. It could be argued that the price is more likely to be attracted to larger Liquidation Level Bubbles. While this is often true, it is not always the case as the strong momentum created by large positions can sustain for a prolonged period before reversing and filling the remaining levels Similarly to other features in this indicator, significant new positions are identified and filtered using standard deviation thresholds and their multipliers. New positions are considered significant when newly opened positions exceed the threshold for “Smaller Size Liquidation,” leading to the creation of new liquidation levels and bubbles.
- If new positions exceed the first standard deviation multiplier (“Smaller Size Liquidation Level”), but do not exceed “Medium Size Liquidation Level”, a smaller-sized bubble appears.
- If new positions exceed the second standard deviation multiplier (”Medium Size Liquidation Level”), but do not exceed “Large Size Liquidation Level”, a medium-sized bubble appears.
- If new positions surpass the third standard deviation multiplier (”Large Size Liquidation Level”), then the large-sized bubble appears.
As demonstrated in the image below (green columns represent new positions opened in the market), significant opened positions are identified and filtered by size using three “thresholds” in the form of standard deviations, which can be modified in the indicator settings.
Increasing the standard deviation multipliers of Liquidation Level Bubbles effectively increases the threshold for a given bubble to occur, making the conditions for its appearance stricter. ⇒ Fewer Liquidation Levels – just larger positions are included
Decreasing the standard deviation multipliers of Liquidation Level Bubbles effectively decreases the threshold for a given bubble to occur, making the conditions for its appearance looser. ⇒ More Liquidation Levels – smaller positions are included
Keep in mind that this should always be the case:
Smaller Size Liquidation Level < Medium Size Liquidation Level < Large Size Liquidation Level
Market Order Bubbles
“Market Order Bubbles” are my experimental concept used as a way to analyze large volumes and visualize the market activity at significant levels under certain conditions. It is based on my imitation of CVD which is also used in other parts of the script. The aim of this concept is to give you an idea about the real-time heavy market buying and selling, which could indicate eg. large liquidations, large entries/exits. in order to add confluence to your analysis.
Please note that this concept is still in its early stages and may be confusing as it might have been poorly implemented. I recommend taking the time to thoroughly read through this section in order to fully understand it. On the other hand, early backtesting results appear very promising, as the win rate of countertrading buy and sell bubbles under certain conditions was fairly high (70%). I will continue working on this tool, so stay tuned for future updates.
Market Buy Order Bubbles appear above price and possibly signal the following:
- Short positions being liquidated (exit short = buy order)
- New traders entering late longs based on FOMO (enter long = buy order)
- New short positions (sells) of “smarter” traders absorbing liquidated/closed shorts (buys)
⇒ Possible reversal to the downside – look for the liquidation levels of longs to get filled
Market Sell Order Bubbles appear below price and possibly signal the following:
- Long positions being liquidated (exit long = sell order)
- New traders entering late shorts based on FOMO (enter short = sell order)
- New long positions (buys) of “smarter” traders absorbing liquidated/closed longs (sells)
⇒ Possible reversal to the upside – look for the liquidation levels of shorts to get filled
As shown in the image, significant volumes are identified and filtered using three “thresholds” in the form of standard deviations, which can be modified in indicator settings.
- If buy/sell volume surpasses the first standard deviation (”Smaller Size Market Orders”), then the smaller-sized bubble appears.
- If buy/sell volume surpasses the second standard deviation (”Medium Size Market Orders”), then the medium-sized bubble appears.
- If buy/sell volume surpasses the third standard deviation (”Large Size Market Orders”), then the large-sized bubble appears.
Increasing the standard deviation multipliers effectively increases the threshold for a given bubble to appear, making the conditions for its occurrence more strict.
Decreasing the standard deviation multipliers effectively decreases the threshold for a given bubble to appear, making the conditions for its occurrence more strict.
Keep in mind that this should always be the case: Smaller Size Market Orders < Medium Size Market Orders < Large Size Market Orders
The Color Candles function is a useful and interesting feature that will enhance your analysis with additional context. If enabled, the indicator will color the chart’s candles based on different data. Currently, there are three options to choose from, with more to be added in future updates.
Color Candles: OI DELTA
This option will color the candles to reflect Open Interest Delta. If there is a net increase in open positions (positive Open Interest Delta), the candle will be colored green. If there is a net decrease in open positions (negative Open Interest Delta), the candle will be colored red. It is important to note that this option only functions on pairs for which Tradingview provides OI data.
Color Candles: VOLUME
This option utilizes volume data to help you identify the trend and momentum, coloring the candles accordingly – upward impulses are colored green and downward impulses are colored red. This makes it easier to recognize trend reversals and adjust your directional bias accordingly.
Color Candles: STOCH
This option uses the Stochastic Oscillator and SMA to color the candles, helping you identify momentum as upward green moves transition to downward red moves and vice versa.
Leverage ratio is another experimental concept I have added to this script. If turned on, it provides a broad insight into whether the market is relatively over-leveraged or if the leverage is relatively low. The aim is to use it as a confluence in anticipating incoming volatility and possible use it to understand other aspects of market activity. It is still in its early stages of development and needless to say, it only works on pairs where Open Interest data is provided by Tradingview.
Crosses above price = Leverage is relatively high
Crosses below price = Leverage is relatively low
Market Info Screener, Level Legend and Hide Filled Lines
The last three inputs of Basic Settings section:
”The Market Info Screener” feature will display a small panel on the right side of your chart that provides useful data about the market, including Open Interest, Volume, the aggressive side of traders, and the Leverage Ratio. More data coming in future updates.
“Level Legend” option will display a small legend on the right side of the chart, helping you or others viewing the chart to understand what do the objects on the chart mean.
“Hide Filled Lines” option will hide liquidation levels that have already been filled, only displaying the active ones in order to reduce clutter on your chart.
The “Appearance” settings offer a variety of modifications for colors, styles, and visibility.
The “Line Style” input allows you to choose the style and width of the liquidation level lines. You can also select which levels to display, as well as the color of the liquidation level lines and bubbles. The “Max Number of Lines” input allows you to specify the number of level lines you want on a chart. If you feel that there is too much clutter, you can decrease this number, and old lines will be removed. Please note that Tradingview has a built-in limit of 500 lines on a given chart, so this value cannot be set above 500. The “Market Buy/Sell Bubble Style” input can be used to modify the color and style of the market order bubbles. Enabling the “Show Settings Screener” option will display a screener with a list of all your settings on the right side of the chart, making it easier to share your preferred settings with others.”
Standard Deviation Multipliers
This is where you can set the standard deviation thresholds for Liquidation Levels and Market Order Bubbles. These values can be customized to your preference, as the default values may not be suitable for your needs or you may want to experiment with different values to see more or fewer liquidation levels or market order bubbles on your chart. Personally, I sometimes use this feature to increase the Large Size Market Orders or Large Size Liquidation Levels multipliers so that large-sized bubbles are only assigned to extremely large positions or volumes.
If you want to only analyze larger positions or volumes, you can increase the “Smaller Size” multipliers, which act as a minimum threshold.
If you also want to include even smaller positions or volumes in your analysis, you can decrease the values of the “Smaller Size” multipliers, which act as a minimum threshold
Please note that the “Reduce Sensitivity” option in Basic Settings affects the standard deviation multipliers of the liquidation levels. Changing the “Reduce Sensitivity” value will equally multiply all of them (the ratio between Smaller, Medium, and Large multiplier values will remain the same)
Standard Deviation Length
“Standard Deviation Length” defines the length (number of bars) used in all calculations that utilize the standard deviation function in this script. Decreasing it will generate Liquidation Levels and Liquidation Bubbles based more on recent data. Increasing it will generate Liquidation Levels and Liquidation Bubbles based on more long-term data.
“CVD Length” refers to the length used in calculating cumulative volumes. Decreasing it will generate Liquidation Levels, Market Order Bubbles, and apply Directional bias based more on recent data. Increasing it will generate those based on more long-term data.”
Level Calculation Mode
This function enables you to switch between three modes of calculating the distance between base and actual liquidation levels.
Copyright option will add your username to the copyright section at the bottom of the chart, giving you credit for your analysis if you post it somewhere.