Psychological levels, also called bank levels, are "round" price numbers, by truncating after the nth leftmost digits, around which price often experience resistance or support, because traders and investors tend to set orders around these round numbers.
The calculation done here is fully automatic and dynamic, contrary to other similar scripts, this one uses a mathematical calculation that extracts the 1, 2 or 3 leftmost digits and calculate the previous and next level by incrementing/decrementing these digits. This means it works for any symbol under any price range.
This approach is based on neuroscience research, which found that human brains intuitively approximate numbers on a logarithmic scale, adults and children alike, and similarly to macaques, for more info see Numerical Cognition, Weber-Fechner Law, Zipf law.
For example, if price is at 0.0421, the next major price level is 0.05 and medium one is 0.043. For another asset currently priced at 19354, the next and previous major price levels are 20000 and 10000 respectively, and the next/previous medium levels are 20000 and 19000, and the next/previous weak levels are 19400 and 19300.
IMPORTANT: Please enable "Scale price chart only" in the chart's scale's options, as otherwise major levels may make the chart's scale very small and hard to read.
How it works
At any time, there are 3 levels of strength (1 leftmost digit, 2 leftmost digits, 3 leftmost digits) represented by different sizes, and 3 directional levels for each of these strengths (level above, level below, and half-level) represented by different colors and positions, around current price.
Indeed, contrary to other similar price levels scripts, we do not plot ALL price levels at all times, because otherwise the chart becomes wayyy too cluttered, and also it's highly processing intensive to plot so many lines. So we here use a dynamical approach: we plot only the relevant levels, the closest ones according to current price.
Hence, when a level disappears, it does not mean that it does not exist anymore, but simply that we are not drawing it right now because it is not pertinent for the current price movement (ie, too far away).
Breakouts can be detected in two different ways depending on if SMA is set to a value higher than 1 or not: if SMA == 1, then there is no smoothing, so the levels adapt instantaneously to the current price, so to detect breakout, you should refer to the levels at the previous tick and whether they were broken by current tick's price; if SMA > 1, then there is some smoothing, and so the levels will stay in-place even if there is a breakout, so it's easier to spot breakouts without having to look at the previous ticks, but on the other hand you won't see the new levels for the new price range until after a few more ticks for the smoothing window to adapt. Hence, by default, smoothing is disabled, so that you can see the currently pertinent levels at all time, even right after or during a breakout.
By default, the strong above level is in green, strong below level is in red, medium above level is in blue, medium below level is in yellow, and weak levels aren't displayed but can be. Half levels are also displayed, in a darker color. Strong levels are increments of the first leftmost digit (eg, 10000 to 20000), medium levels are increments of the second leftmost digit (eg, 19000 to 20000), and weak levels of the third leftmost digit (eg, 19100 to 19200). Instead of plotting all the psychological levels all at once as a grid, which makes the chart unintelligible, here the levels adapt dynamically around the current price, so that they show the above/below/half levels relatively to the current price.
Indeed, "half-levels" are also displayed (eg, medium level can also display 19500 instead of only 19000 or 20000). This was made because otherwise the gap between two levels was too big, especially for the strongest levels (eg, there was no major level between 20000 and 30000, but with a half-step we also get a half-level at 25000, and empirically price tends to respect these half levels - I also tried quarter levels but empirically the results were not good). In addition to this hard-coded half-level, you can also create more subdivisions (eg, quarter levels) by setting the simple moving average to a value higher than 1.
The script can be made to run on the daily timeframe whatever the current chart's timeframe is, to reduce the variability in levels, to make it less noisy than intraday price movement. But by default, the chart resolution is used, because I empirically found that the levels found with this indicator work on all time resolutions quite well.
The step can be adjusted to increase the gap between levels, eg, if you want to display one every 2 levels then input step = 2 (eg, 22000, 24000, 26000, etc), or if you want to display quarter levels, input 0.25 (eg, 22000, 22250, 22500, etc). The default values should fit most use cases and cover most psychological levels.
How to read
- Focust first on bigger dotted levels, they are stronger and more likely to cause a rebound or a major event or price to stay at this level.
- Remember that it's not enough to just look at levels, the context is important, because levels have various effects depending on current price movement: if price is above a level, the level is a support on which price can rebound; if price is below a level, the level is a resistance on which price can rebound (or break); and finally sometimes price also stays hovering around a level for some time.
- Levels closer to 9 are less weaker, and levels closer to 0 are stronger, according to Zipf law. This is now reflected since v3 in the transparency, levels that are closer to 9 will be more transparent.
- The switch in color for the same level illustrates how a level switches from being a support to a resistance and inversely. Eg, if a major level turns from green to red, then it changed from being a resistance (above) to a support (below).
- As is well known in trading, longer standing levels are stronger. This indicator provides a direct illustration: in practice, the number of consecutive dots on the same line influences the strength of the level: the longer the chain of dots, the more you can expect this price level to be significant. The length does not mean the level will necessarily hold, but that other traders are likely to monitor if it holds, and if not then price will break down. Hence, longer levels are good spots to place stop losses, or to enter trades depending on your strategy. In general, a single dot is not enough to consider a level significant, but 2 or more is a good enough level, and 10+ is a strong level. Intuitively, this makes sense, and is what pro traders do: the longer a level is tested, the stronger it is. This indicator can visually represent this intuition and allows to use it as a more systematic trading signal.
I initially made the first version of the PsychoLevels indicator mainly to train with PineScript, but I found it surprisingly accurate to define levels that are respected by price movements. So I guess it can be useful for new traders and experienced traders alike, as it's easy to forget that psychological levels can often be as strong if not stronger than technical levels. It can also be used to quickly screen other minor assets for trading opportunities. For example, a hybrid strategy would be to manually define levels on BTCUSD but using this script to automatically define levels in crypto altcoins and quickly screen them for a trade opportunity that can be greater than with BTCUSD but with the same trend.
Personally, although initially I did not believe an automated tool would work well for this purpose, I could now empirically verify that it is quite reliable for the purpose of detecting levels, and so I use it all the time to find the levels automatically and help me monitor them like a hawk, so that I only have to draw uber major levels, the ones that last between cycles and that are hard to autodetect, but otherwise all daily/weekly levels are usually covered. However, trendlines must still be drawn manually or with another indicator (but note that up to now I have found none that worked well enough), as PsychoLevels only draws levels (ie, horizontal lines, not oblique ones!).
Differences with the previous version PsychoLevels v2
- price levels now have a transparency according to their importance for the human brain: numbers closer to 9 are weaker, and numbers closer to 0 are stronger and represent a major psychological threshold (eg, that's why prices marked as $9.99 sell better than $10.00). This option can be disabled to get the exact same behavior as v2.
- modularized and typed code
PsychoLevels v2 can be found here:
* Zipf transparency was incorrectly calculated (used the wrong digit for the wrong level). This is now fully corrected.
* Weak level above was not smoothed anymore (if SMA was enabled), this is an artifact from a botched refactoring attempt.
* Restored the ability to customize colors, as in v2 (but the color options are in Inputs, not in Style, because of how PineScript handles colors with variable transparency).
Dalam semangat TradingView, penulis dari skrip ini telah mempublikasikannya ke sumber-terbuka, maka trader dapat mengerti dan memverifikasinya. Semangat untuk penulis! Anda dapat menggunakannya secara gratis, namun penggunaan kembali kode ini dalam publikasi diatur oleh Tata Tertib. Anda dapat memfavoritkannya untuk digunakan pada chart
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.