quantifytools

Price based concepts / quantifytools

quantifytools Diupdate   
- Overview

Price based concepts incorporates a collection of multiple price action based concepts. Main component of the script is market structure, on top of which liquidity sweeps and deviations are built on, leaving imbalances the only standalone concept included. Each concept can be enabled/disabled separately for creating a selection of indications that one deems relevant for their purposes. Price based concepts are quantified using metrics that measure their expected behavior, such as historical likelihood of supportive price action for given market structure state and volume traded at liquidity sweeps. The concepts principally work on any chart, whether that is equities, currencies, cryptocurrencies or commodities, charts with volume data or no volume data. Essentially any asset that can be considered an ordinary speculative asset. The concepts also work on any timeframe, from second charts to monthly charts. None of the indications are repainted.

Market structure
Market structure is an analysis of support/resistance levels (pivots) and their position relative to each other. Market structure is considered to be bullish on a series of higher highs/higher lows and bearish on a series of lower highs/lower lows. Market structure shifts from bullish to bearish and vice versa on a break of the most recent pivot high/low, indicating weak ability to defend a key level from the dominating side. Supportive market structure typically provides lengthier and sustained trending environment, making it an ideal point of confluence for establishing directional bias for trades.


Liquidity sweeps
Liquidity sweeps are formed when price exceeds a pivot level that served as a provable level of demand once and is expected to display demand again when revisited. A simple way to look at liquidity sweeps is re-tests of untapped support/resistance levels.


Deviations
Deviations are formed when price exceeds a reference level (market structure shift level/liquidity sweep level) and shortly closes back in, leaving participating breakout traders in an awkward position. On further adverse movement, stuck breakout traders are forced to cover their underwater positions, creating ideal conditions for a lengthier reversal.


Imbalances
Imbalances, also known as fair value gaps or single prints, depict areas of inefficient and one sided transacting. Given inclination for markets to trade efficiently, price is naturally attracted to areas that lack proper participation, making imbalances ideal targets for entries or exits.


Key takeaways
- Price based concepts consists of market structure, liquidity sweeps, deviations and imbalances.
- Market structure shifts from bullish to bearish and vice versa on a break of the most recent pivot high/low, indicating weak ability to defend a key level from the dominating side.
- Supportive market structure tends to provide lengthier and sustained movement for the dominating side, making it an ideal foundation for establishing directional bias for trades.
- Liquidity sweeps are formed when price exceeds an untapped support/resistance level that served as a provable level of demand in the past, likely to show demand again when revisited.
- Deviations are formed when price exceeds a key level and shortly closes back in, leaving breakout traders in an awkward position. Further adverse movement compels trapped participants to cover their positions, creating ideal conditions for a reversal.
- Imbalances depict areas of inefficient and one sided transacting where price is naturally attracted to, making them ideal targets for entries or exits.
- Price based concepts are quantified using metrics that measure expected behavior, such as historical likelihood of supportive structure and volume traded at liquidity sweeps.
- For practical guide with practical examples, see last section.

Accessing script 🔑
See "Author's instructions" section, found at bottom of the script page.

Disclaimer
Price based concepts are not buy/sell signals, a standalone trading strategy or financial advice. They also do not substitute knowing how to trade. Example charts and ideas shown for use cases are textbook examples under ideal conditions, not guaranteed to repeat as they are presented. Price based concepts notify when a set of conditions are in place from a purely technical standpoint. Price based concepts should be viewed as one tool providing one kind of evidence, to be used in conjunction with other means of analysis.

Price based concepts are backtested using metrics that reasonably depict their expected behaviour, such as historical likelihood of supportive price movement on each market structure state. The metrics are not intended to be elaborate and perfect, but to serve as a general barometer for feedback created by the indications. Backtesting is done first and foremost to exclude scenarios where the concepts clearly don't work or work suboptimally, in which case they can't be considered as valid evidence. Even when the metrics indicate historical reactions of good quality, price impact can and inevitably does deviate from the expected. Past results do not guarantee future performance.

- Example charts

Chart #1: BTCUSDT


Chart #2: EURUSD


Chart #3: ES futures


Chart #4: NG futures


Chart #5: Custom timeframes


- Concepts

Market structure
Knowing when price has truly pivoted is much harder than it might seem at first. In this script, pivots are determined using a custom formula based on volatility adjusted average price, a fundamentally different approach to the widely used highest/lowest price within X amount of bars. The script calculates average price within set period and adjusts it to volatility. Using this formula, the script determines when price has turned significantly enough and aggressively enough to constitute a relevant pivot, resulting in high accuracy while ruling out subjective decision making completely. Users can adjust length of market structure basis and sensitivity of volatility adjustment to achieve desired magnitude of pivots, reflected on the average swing metrics. Note that structure pivots are backpainted. Typical confirmation time for a pivot is within 2-3 bars after peak in price.


Market structure shifts
Generally speaking, traders consider market structure to have shifted when most recent structure high/low gets taken out, flipping underlying bias from one side over to the other (e.g. from bullish structure favoring upside to bearish structure favoring downside). However, there are many ways to approach the concept and the most popular method might not always be the best one. Users can determine their own market structure shift rules by choosing source (close, high, low, ohlc4 etc.) for determining structure shift. Users can also choose additional rules for structure shift, such as two consecutive closes above/below pivot to qualify as a valid shift.


Liquidity sweeps
Users can set maximum amount of bars liquidity levels are considered relevant from the moment of confirmed pivot. By default liquidity levels are monitored for 250 bars and then discarded. Level of tolerance can be set to anything between 100 and 1000 bars. For each liquidity sweep, relative volume (volume relative to volume moving average) is stored and added to average calculations for keeping track of typical depth of liquidity found at sweeps.


Deviations
Users can set a maximum amount of bars price has to spend above/below reference level to consider a deviation to be in place. By default set to 6 bars.


Imbalances
Users can set a desired fill point for imbalances using the following options: 100%, 75%, 50%, 25%. Users can also opt for excluding insignificant imbalances to attain better relevance in indications.


- Backtesting

Built-in backtesting is based on metrics that are considered to reasonably quantify expected behaviour of the main concept, market structure. Structure feedback is monitored using two metrics, supportive structure and structure period gain. Rest of the metrics provided are informational in nature, such as average swing and average relative volume traded at liquidity sweeps. Main purpose of the metrics is to form a general barometer for monitoring whether or not the concepts can be viewed as valid evidence. When the concepts are clearly not working optimally, one should adjust expectations accordingly or take action to improve performance. To make any valid conclusions of performance, sample size should also be significant enough to eliminate randomness effectively. If sample size on any individual chart is insufficient, one should view feedback scores on multiple correlating and comparable charts to make up for the loss.

For more elaborate backtesting, price based concepts can be used in any other script that has a source input, including fully mechanic strategies utilizing Tradingview's native backtester. Each concept and their indications (e.g. higher low on a bearish structure, lower high on a bullish structure, market structure shift up, imbalance filled etc.) can be utilized separately and used as a component in a backtesting script of your choice.


Structure feedback
Structure feedback is monitored using two metrics, likelihood of supportive price movement following a market structure shift and average structure period gain. If either of the two employed tests indicate failed reactions beyond a tolerable level, one should take action to improve feedback by adjusting the settings. If feedback metrics after adjusting the settings are still insufficient, the concepts are working suboptimally for the given chart and cannot be regarded as valid technical evidence as they are.

Metric #1: Supportive structure


Each structure pivot is benchmarked against its respective structure shift level. Feedback is considered successful if structure pivot takes place above market structure shift level (in the case of bullish structure) or below market structure shift level (in the case of bearish structure). Structure feedback constitutes as one test indicating how often a market structure state results in price movement that can be considered supportive.

Metric #2: Structure period gain


Each structure period is expected to present favorable appreciation, measured from one market structure shift level to another. E.g. bullish structure period gain is measured from market structure shift up level to market structure shift down level that ends the bullish structure period. Bearish structure is measured in a vice versa manner, from market structure shift down level to market structure shift up level that ends the bearish structure period. Feedback is considered successful if average structure period gain is supportive for a given structure (positive for bullish structure, negative for bearish structure).

Additional metrics
On top of structure feedback metrics, percentage gain for each swing (distance between a pivot to previous pivot) is recorded and stored to average calculations. Average swing calculations shed light on typical pivot magnitude for better understanding changes made in market structure settings. Average relative volume traded at liquidity sweep on the other hand gives a clue of depth of liquidity typically found on a sweeps.

Feedback scores
When market structure (basis for most concepts) is working optimally, quality threshold for both feedback metrics are met. By default, threshold for supportive structure is set to 66%, indicating valid feedback on 2/3 of backtesting periods on average. On top, average structure period gain needs to be positive (for bullish structures) and negative (for bearish structure) to qualify as valid feedback. When both tests are passed, a tick indicating valid feedback will appear next to feedback scores, otherwise an exclamation mark indicating suboptimal performance on either or both. If both or either test fail, market structure parameters need to be optimized for better performance or one needs to adjust expectations accordingly.


Verifying backtest calculations
Backtest metrics can be toggled on via input menu, separately for bullish and bearish structure. When toggled on, both cumulative and average counters used in backtesting will appear on "Data Window" tab. Calculation states are shown at a point in time where cursor is hovered. E.g. when hovering cursor on 4th of January 2021, backtest calculations as they were during this date will be shown.


- Alerts

Available alerts are the following.

- HH/HL/LH/LL/EQL/EQH on a bullish/bearish structure
- Bullish/bearish market structure shift
- Bullish/bearish imbalance created
- Bullish/bearish imbalance filled
- Bullish/bearish liquidity sweep
- Bullish/bearish deviation

- Visuals

Each concept can be enabled/disabled separately for creating a selection indications that one deems relevant for their purposes. On top, each concept has a stealth visual option for more discreet visuals.


Unfilled imbalances and untapped liquidity levels can be extended forward to better gauge key areas of interest.


Liquidity sweeps have an intensity option, using color and width to visualize volume traded at sweep.


Market structure states and market structure shifts can be visualized as chart color.


Metric table can be offsetted horizontally or vertically from any four corners of the chart, allowing space for tables from other scripts.


Table sizes, label sizes and colors are fully customizable via input menu.

- Practical guide

The basic idea behind market structure is that a side (bulls or bears) have shown significant weakness on a failed attempt to defend a key level (most recent pivot high/low). In the same way, a side has shown significant strength on a successful attempt to break through a key level. This successful break through a key level often leads to sustained lengthier movement for the side that provably has the upper hand, making it an ideal tool for establishing directional bias.


Multi-timeframe view of market structure provides crucial guidance for analyzing market structure states on any individual timeframe. If higher timeframe market structure is bullish, it doesn't make sense to expect contradicting lower timeframe market structure to provide significant adverse movement, but rather a normal correction within a long term trend. In the same way, if lower timeframe market structure is in agreement with higher timeframe market structure, one can expect a reliable trending environment to ensue as multiple points of confluence are in place.


Bullish structure can be considered constructive on a series of higher highs and higher lows, indicating strong interest from bulls to sustain an uptrend. Vice versa is true for bearish structure, a series of lower highs and lower lows can be considered constructive. When structure does not indicate strong interest to maintain a supportive trend (lower highs on bullish structure, higher lows on bearish structure), a structure shift and a turn in trend might be nearing.


Market structure shifts are of great interest for breakout traders who position for continuation. Structure shifts can indeed be fertile ground for executing a breakout trade, but breakouts can easily turn into fakeouts that leave participants in an awkward position. When price moves further away from the underwater participants, potential for snowball effect of covering positions and driving price further away is elevated.


Liquidity sweeps as a concept is based on the premise that pivoting price is evidence of meaningful depth of liquidity found at/around pivot. If liquidity existed at a pivot once, it is likely to exist there in the future as well. When price grinds against liquidity, it is on a path of resistance rather than path of least resistance. Pivots are also attractive placements for traders to set stop-losses, which act as fuel for price to move to the opposite direction when swept and triggered.


Behind tightly formed pivots are potentially many stop-loss orders lulled in the comfort of having many layers of levels protecting their position. Compression that leaves such clusters of unswept liquidity rarely goes unvisited.


As markets strive for efficient and proper transacting most of the time, imbalances serve as points in price where price is naturally attracted to. However, imbalances too are contextual and sometimes one sided trading is rewarded with follow through, rather than with a fill. Identifying market regimes give further clue into what to expect from imbalances. In a ranging environment, one can expect imbalances to fill relatively quick, making them ideal targets for entries and exits.


On a strongly trending environment on the other hand imbalances tend to stick for a much longer time. In such environments continuation can be expected with no fills or only partial fills. Signs of demand preventing fill attempts serve as additional clues for imminent continuation.

Catatan Rilis:
Update

Price action levels

Users can set up to 10 price action levels using any source (open, high, low, close, mid-point) fetched from desired timeframe or a custom session. Users can also choose whether to show real-time developing levels or historical ones.


By default, levels are drawn from the beginning of each respective timeframe/session. Alternatively, levels can be brought forward by set amount.


Deviation metrics and deviation intensity visuals

For each deviation, relative volume (volume relative to its respective moving average) traded during deviation build-up period is stored and added to average calculations. Volume traded at deviation gives an idea of typical magnitude of trapped breakout traders transacting at deviations. Deviation intensity functions the same way liquidity sweep intensity does. The closer the color is to red, the more abnormal volume traded (i.e. magnitude of trapped traders) at deviation is.


Structure shift buffer

Users can apply a set amount of "wiggle room" to market structure to better deal with false structure shifts, often leading to improved feedback.


Minor changes

Simple on/off imbalance filter changed to an adjustable one. Users can set a threshold for imbalance size to qualify as valid, e.g. equal to or greater than median imbalance size = valid imbalance.

Added market structure label offset. Offsets labels up/down from highs/lows by set amount.
Catatan Rilis:
Update

1. Revised visual layout

Default visual layout is now as follows. Added more visualization options that can be enabled via settings menu.


2. Conditional visibility for structure pivots

Added conditional visibility for structure pivots. Users can apply a condition or disable completely each structure pivot type (HH, LH, LL, HL, EQH, EQL) separately.


3. Events

Alerts are now defined using events. Users can generate 2 events with desired indications as they are or by combining and grouping indications under 1 alert using AND/OR interpretation logic. When using AND logic, all selected indications must occur simultaneously to trigger an event, e.g. liquidity sweep AND bullish structure state. When using OR logic, any of the selected indications occuring will trigger an event, e.g. either liquidity sweep OR bullish structure state.

Generated events can also be assigned a special value that is outputted when given event occurs, allowing backtesting specific events with a third party backtesting script. Generated events can be used to trigger alerts by choosing Event #1 or Event #2 in the alert menu. Events/alerts can be previewed by ticking "Preview events".


4. Revised backtesting

Backtesting metrics revised to simple, easy to understand metrics that better reflect the variations in performance across different charts. Market structure is now backtested using two key metrics, net price change and supportive change. Net change is calculated by cumulating price change on structure states, positive change being added to cumulative counters, negative change subtracted from cumulative counters. Supportive price change is essentially a win rate calculation, indicating how many structure states end with expected net change.

All calculations are verifiable and open for inspection by users by opening them up on Data Window tab.


A breakdown of perfomance metrics can be enabled by hovering cursor over gray tooltip next to metric table. If any of the applied tests have failed, an orange dot will appear instead. Failed tests call for caution and optimizing settings to achieve better performance.


Minor changes
Size and offset inputs for visuals
Volume metrics now use volatility instead for charts that have no volume data
Catatan Rilis:
Update

Minor changes to UI
"Supportive score" -> "Win rate"
Catatan Rilis:
Update

Bug fixes and optimization

✨ Get instant access to Premium toolstack for free: Liquidity prints, Price based concepts and Liquidity composition

✨ Start 14-day free trial: www.quantify.tools

Watch video tutorials covering our tools on Youtube ↓
Skrip hanya-undangan

Akses ke skrip ini dibatasi hanya bagi pengguna yang telah diberi otorisasi oleh penulisnya dan biasanya membutuhkan pembayaran untuk dapat menggunakannya. Anda dapat menambahkannya ke favorit anda, tetapi anda hanya akan dapat menggunakannya setelah meminta izin dan mendapatkan aksesnya dari pembuat skripnya. Hubungiquantifytools untuk informasi lebih lanjut, atau ikuti instruksi penulisnya dibawah ini.

TradingView tidak menyarankan membayar untuk sebuah skrip dan harap untuk menggunakannya sampai anda telah 100% mempercayai penulisnya dan memahami cara kerja skripnya. Dalam sebagain besar kasus, anda dapat menemukan alternatif open-source yang baik secara gratis di Skrip Komunitas kami.

Pernyataan Penyangkalan

Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.

Instruksi penulis

Visit website to get access: www.quantify.tools

Inggin menggunakan skrip ini pada chart?

Peringatan: harap membaca sebelum meminta akses.