OPEN-SOURCE SCRIPT

Psychological levels (Bank levels) by tartigradia

Updated
Psychological levels (Bank levels) plots the price levels by truncating after the nth leftmost digits, as it appears the humain brain tends to intuitively calculate in log/zipf.

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 asset at any price range.

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.

By default, strong upper level is in green, strong lower level is in red, medium upper level is in blue, medium lower level is in yellow, and weak levels aren't displayed but can be. 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 upper/lower levels relatively to the current price.

A simple moving average is implemented, so that "half-levels" are also displayed when relevant (eg, medium level can also display 19500 instead of only 19000 or 20000). This can be disabled by setting smoothing to 1.

I made this script mainly to train with PineScript, but I guess it can be useful for new traders, as it's easy to forget that psychological levels can often be as strong if not stronger than technical levels.
Release Notes
More explanatory tooltip
Release Notes
Disable gaps by default so that levels cover current day
Release Notes
Updates:
* no gaps by default to force repainting of current day
* default to circles instead of stepline for a cleaner, less cluttered visual
Bands and ChannelsPivot points and levelspsychologicallevelsresistance_levelsupport_level

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer