PROTECTED SOURCE SCRIPT

UNDERWATER EQUITY INDEX [DIGGERDOG]

UNDERWATER EQUITY INDEX [DIGGERDOG]

This TradingView Pine Script titled **"UNDERWATER EQUITY INDEX [DIGGERDOG]"** displays the percentage drawdown of an equity curve and calculates an RSI-based oscillator based on the drawdown. The oscillator is smoothed and presented with optimized colors to visually highlight bullish, bearish, and potential reversal trends.

Script Explanation:


1. **Variable Initialization:**
- `highestEquity`: This variable stores the highest value of the equity curve.
- `underwaterEquity`: This variable stores the current drawdown, calculated as a percentage relative to the highest equity value.

2. **Equity Curve:**
- The script uses the closing price (`close`) as a placeholder for the equity curve. In a real-world application, this could be replaced with an actual equity curve.

3. **Highest Equity Calculation:**
- The `highestEquity` is updated as the highest recorded equity value. If the variable is uninitialized (`na`), it is set to the current equity value.

4. **Drawdown Calculation:**
- The drawdown is calculated as the percentage difference between the current equity and the highest recorded equity value.

5. **RSI-Based Oscillator:**
- The oscillator (`osc`) is calculated using the RSI (Relative Strength Index) over a 13-period window based on the drawdown and is smoothed using a simple moving average (SMA) over 9 periods.

6. **Plot Colors:**
- **Green**: Bullish trend (equity increasing above the zero line).
- **Orange**: Warning signal (falling trend above the zero line).
- **Blue**: Potential bullish reversal (rising trend below the zero line).
- **Red**: Bearish trend (falling trend below the zero line).

7. **Plotting the Oscillator:**
- The smoothed oscillator is plotted as a line with the color codes mentioned above.

8. **Threshold Lines:**
- Three horizontal lines at 30, 50, and 70 indicate extreme points (30 and 70 signal oversold and overbought conditions, respectively).

9. **Marking Extremes:**
- When enabled, the script marks extreme values in the oscillator with a green background when the value exceeds 60 (potentially overbought) and a red background when it falls below 40 (potentially oversold).

Usage:
- **Drawdown Analysis**: Track drawdowns in the equity curve to assess risk performance.
- **Trend and Reversal Signals**: The smoothed RSI-based oscillator indicates potential bullish or bearish phases, including warning signals for possible reversals.
- **Visualization of Extremes**: Utilize the background highlighting of extreme oscillator values to immediately recognize overbought or oversold conditions.

This script is useful for monitoring risk and drawdowns while visually presenting key trend information. If you have further questions or need adjustments, feel free to let me know!
Oscillators

Скрипт с защищённым кодом

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

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

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