OPEN-SOURCE SCRIPT

Price Deviation Indicator (PDI)

Management
The Price Deviation Indicator (PDI) was developed by "DimArt". This indicator allows you to determine the percentage deviation of the price from its average value over a certain period of time. The larger the deviation, the higher the histogram on the indicator chart. The PDI indicator can be useful for identifying a trend reversal in combination with other technical indicators, such as RSI, MACD, and others. For example, if the RSI and MACD indicators show the beginning of a possible trend reversal, using the PDI indicator can confirm this signal by showing the deviation of the current price from the average price. This can help the trader make more accurate trading decisions based on a strong signal.

Description
To calculate the values of the "Price Deviation Indicator" (PDI), we use the following steps:
• Determine the "Period" variable, which specifies the number of bars used to calculate the average price. (Default value is 20)
• Calculate the average price over the specified period using the "sma()" (simple moving average) function.
• Calculate the percentage difference between the current price and the average price using the formula: ((close - avg_price) / avg_price) * 100.
• Set levels to change the color of the histogram based on price deviation from the average value. "Histogram Color" is a parameter to customize the color of the histogram based on deviation levels. By default, if the deviation is more than 5%, the histogram will be red; if it is less than -5%, it will be green, and for all other deviations, it will be blue. However, this parameter can be changed to other values.
• Draw a histogram of price change relative to the average value. The "Style" parameter allows you to choose the style of the indicator (histogram). By default, the "Histogram" style is set, but you can also select "Line on Close" or "Line on Open".

Application of the Indicator
The PDI indicator is based on the assumption that the price of any asset always tends to its mean value. Using PDI on higher timeframes allows you to determine the overall market trend, whereas on smaller timeframes, situations can be found when the price is in negative territory, and the histogram starts to smoothly transition from negative to positive value. This can be a signal to buy, as the price is likely in an oversold condition and ready to change its trend. On the other hand, if the strength of the price slows down or begins to approach 0, this may indicate that the asset is overbought and starting to turn towards oversold, which is a signal to sell. A beautiful feature of the PDI indicator is its simplicity and conciseness, which allows you to quickly and easily identify a trend change and make trading decisions based on a strong signal.

Conclusion
The "Price Deviation Indicator" (PDI) can be useful in analyzing price movements in the market. It allows you to calculate the relative difference between the current price and the average price, allowing you to identify market saturation and change in trend. The indicator can be used in technical analysis to make decisions about buying or selling assets on the exchange. It can also be useful for traders of different levels of experience, as its settings can be adapted depending on the user's needs and requirements. Overall, this indicator is one of the tools that can help in analyzing price and volumes to determine possible investment prospects in assets.
Advance/Decline RatioPDIPivot points and levelsWave Analysis

Скрипт с открытым кодом

В истинном духе TradingView автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения. Вы можете добавить этот скрипт в избранное и использовать его на графике.

Хотите использовать этот скрипт на графике?

Отказ от ответственности