OPEN-SOURCE SCRIPT

RSIOMA with Volume Index Confirmation

Mis à jour
This indicator is called "RSIOMA with Volume Index Confirmation". It is a technical analysis tool that plots buy and sell signals on a chart based on the Relative Strength Index (RSI) and the Negative Volume Index (NVI) and Positive Volume Index (PVI) indicators.

The indicator has the following input parameters:


- RSI Length: determines the number of periods used to calculate the RSI. Default value is 14.

- Overbought Level: determines the RSI level at which a security is considered overbought. Default value is 70.

- Oversold Level: determines the RSI level at which a security is considered oversold. Default value is 30.

- NVI Length: determines the number of periods used to calculate the Negative Volume Index. Default value is 255.

- PVI Length: determines the number of periods used to calculate the Positive Volume Index. Default value is 255.

The indicator calculates the RSI using the RSI Length input parameter and the close price of the security. It also calculates the NVI and PVI by looping through the volume data and the close price data of the security over the specified periods.

The indicator then uses the RSI, NVI, and PVI to determine buy and sell signals. A bearish divergence signal is generated when the RSI from one period ago is greater than the Overbought Level, the current RSI is less than the Overbought Level, and the close price from one period ago is greater than the current close price. A bullish divergence signal is generated when the RSI from one period ago is less than the Oversold Level, the current RSI is greater than the Oversold Level, and the close price from one period ago is less than the current close price. A sell signal is generated when a bearish divergence signal occurs and the current NVI is less than the previous NVI value. A buy signal is generated when a bullish divergence signal occurs and the current PVI is greater than the previous PVI value.

The indicator plots the buy and sell signals on the chart as green and red triangles, respectively. The "overlay=true" parameter in the indicator function indicates that the signals are plotted on top of the security's price chart.
Notes de version
Update Summary:

Integration of NVI and PVI Functions: Added custom functions f_nvi() and f_pvi() to calculate the Negative Volume Index (NVI) and Positive Volume Index (PVI), since they are not built-in functions in Pine Script. This ensures accurate computation of these indices within the script.

Elimination of Inefficient Loops: Removed the for loops used in the original code for calculating NVI and PVI. This change enhances performance by avoiding unnecessary iterations over historical data.

Correction of NVI and PVI Calculations: Updated the formulas for NVI and PVI to align with standard definitions. The new calculations accurately reflect the cumulative effect of price changes when volume conditions are met.

Simplification of RSI Calculations: Optimized the RSI computation by calculating it once and storing its previous value for comparisons. This reduces redundant calculations and improves efficiency.

Refinement of Signal Conditions: Simplified and corrected the conditions for generating buy and sell signals. The updated logic provides clearer and more accurate entry points based on RSI divergences confirmed by NVI and PVI movements.

Proper Variable Initialization: Used the var keyword for variables that need to retain their values across bars. This ensures correct recursive calculations for NVI and PVI and prevents errors related to undeclared identifiers.

Improved Code Organization: Modularized the script by encapsulating NVI and PVI calculations within their respective functions. This enhances code readability, maintainability, and aligns with best practices in Pine Script programming.
omaRelative Strength Index (RSI)rsidivergencevolumespike

Script open-source

Dans le plus pur esprit TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par nos Règles. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Vous voulez utiliser ce script sur un graphique ?

Clause de non-responsabilité