From 6f6e12520e1ede10a004d5db3c340dd34fea4235 Mon Sep 17 00:00:00 2001 From: Toh4iem9 Date: Sat, 22 Nov 2025 12:24:58 +0100 Subject: [PATCH] chore: delete old RSI_Adaptive files --- Indicators/MyIndicators/RSI_Adaptive_Pro.md | 67 ---------------- Indicators/MyIndicators/RSI_Adaptive_Pro.mq5 | 80 -------------------- 2 files changed, 147 deletions(-) delete mode 100644 Indicators/MyIndicators/RSI_Adaptive_Pro.md delete mode 100644 Indicators/MyIndicators/RSI_Adaptive_Pro.mq5 diff --git a/Indicators/MyIndicators/RSI_Adaptive_Pro.md b/Indicators/MyIndicators/RSI_Adaptive_Pro.md deleted file mode 100644 index 47900ed..0000000 --- a/Indicators/MyIndicators/RSI_Adaptive_Pro.md +++ /dev/null @@ -1,67 +0,0 @@ -# Adaptive RSI Professional - -## 1. Summary (Introduction) - -The `RSI_Adaptive_Pro` is an advanced version of the Relative Strength Index that dynamically adjusts its own lookback period based on market volatility. This concept, also known as the Dynamic Momentum Index (a different concept from Wilder's DMI), aims to create a more responsive RSI in trending markets and a smoother RSI in ranging markets. - -The core logic is to: - -* **Shorten** the RSI period when volatility is high (strong trend), making the oscillator more sensitive to price changes. -* **Lengthen** the RSI period when volatility is low (sideways market), making the oscillator smoother and less prone to generating false signals. - -This indicator provides a unique perspective on momentum, offering a different character compared to the classic, fixed-period RSI. - -## 2. Mathematical Foundations and Calculation Logic - -The indicator first calculates a volatility ratio and then uses it to determine the appropriate RSI period for each bar. - -### Required Components - -* **Pivotal Period (N):** The central or "normal" RSI period around which the adaptive period will fluctuate. -* **Volatility Periods (S, L):** A short (`S`) and long (`L`) period for measuring volatility. -* **Source Price (P)**. - -### Calculation Steps (Algorithm) - -1. **Calculate Volatility Ratio:** The indicator measures volatility by comparing the recent sum of price changes to its longer-term average. - * $\text{Short-Term Volatility}_t = \sum_{i=0}^{S-1} \text{Abs}(P_{t-i} - P_{t-i-1})$ - * $\text{Long-Term Volatility}_t = \text{SMA}(\text{Short-Term Volatility}, L)_t$ - * $\text{Volatility Ratio}_t = \frac{\text{Short-Term Volatility}_t}{\text{Long-Term Volatility}_t}$ - -2. **Calculate the Adaptive RSI Period (NSP):** The Volatility Ratio is used to adjust the pivotal period. - * $\text{NSP}_t = \text{Integer}[\frac{N}{\text{Volatility Ratio}_t}]$ - * The calculated period is then clamped within a reasonable range (e.g., between 2 and `N*2`) to prevent extreme values. - -3. **Calculate the Simple RSI with the Adaptive Period:** For maximum stability with a constantly changing period, a **Simple RSI** is calculated on each bar using the dynamic `NSP`. - * $\text{Sum Up}_t = \text{Sum of positive price changes over the last NSP}_t \text{ bars}$ - * $\text{Sum Down}_t = \text{Sum of absolute negative price changes over the last NSP}_t \text{ bars}$ - * $\text{Adaptive RSI}_t = 100 \times \frac{\text{Sum Up}_t}{\text{Sum Up}_t + \text{Sum Down}_t}$ - -## 3. MQL5 Implementation Details - -* **Self-Contained Calculation Engine (`RSI_Adaptive_Calculator.mqh`):** The entire multi-stage calculation logic is encapsulated within a single, dedicated include file. - -* **Stable RSI Calculation:** Due to the constantly changing lookback period, the calculator uses a non-recursive, "brute-force" Simple RSI calculation on each bar. This is computationally more intensive than Wilder's smoothed RSI but guarantees stability and prevents artifacts that could arise from a recursive formula with a variable period. - -* **Object-Oriented Design (Inheritance):** The standard `_HA` derived class architecture is used to seamlessly support calculations on Heikin Ashi price data. - -## 4. Parameters - -* **Pivotal Period (`InpPivotalPeriod`):** The central RSI period. The adaptive period will be shorter than this in high volatility and longer in low volatility. Default is `14`. -* **Volatility Short (`InpVolaShort`):** The short-term lookback period for measuring the "current" volatility. Default is `5`. -* **Volatility Long (`InpVolaLong`):** The long-term lookback period for calculating the average volatility. Default is `10`. -* **Applied Price (`InpSourcePrice`):** The source price for the calculation. - -## 5. Usage and Interpretation - -The Adaptive RSI offers a different "feel" compared to the classic RSI, which is crucial to understand. - -* **Comparison to Classic RSI:** - * **In High Volatility (Trending Markets):** The Adaptive RSI's period shortens. This makes it **more responsive and "spiky"** than a classic RSI. It will reach extreme overbought/oversold levels faster and more frequently, providing earlier signals of potential exhaustion. - * **In Low Volatility (Ranging Markets):** The Adaptive RSI's period lengthens. This makes it **smoother and flatter**, often hovering closer to the 50 level. This helps to filter out the noise and false signals common in sideways markets. - -* **Strategy:** - * Use it to identify potential trend exhaustion. The sharp, deep moves into the >70 or <30 zones during a strong trend can provide earlier warnings than a classic RSI. - * Use it as a range filter. When the Adaptive RSI becomes very flat and stays near the 50 level, it's a strong indication of a low-volatility, consolidating market, where breakout strategies might be prepared. - -It is an excellent tool for traders who find the classic RSI too slow in fast markets but too noisy in slow markets. diff --git a/Indicators/MyIndicators/RSI_Adaptive_Pro.mq5 b/Indicators/MyIndicators/RSI_Adaptive_Pro.mq5 deleted file mode 100644 index 56abf0e..0000000 --- a/Indicators/MyIndicators/RSI_Adaptive_Pro.mq5 +++ /dev/null @@ -1,80 +0,0 @@ -//+------------------------------------------------------------------+ -//| RSI_Adaptive_Pro.mq5 | -//| Copyright 2025, xxxxxxxx| -//| | -//+------------------------------------------------------------------+ -#property copyright "Copyright 2025, xxxxxxxx" -#property version "1.00" -#property description "Adaptive RSI with a variable period based on market volatility." - -#property indicator_separate_window -#property indicator_buffers 1 -#property indicator_plots 1 -#property indicator_type1 DRAW_LINE -#property indicator_color1 clrDodgerBlue -#property indicator_style1 STYLE_SOLID -#property indicator_width1 1 -#property indicator_label1 "Adaptive RSI" - -#property indicator_minimum 0 -#property indicator_maximum 100 -#property indicator_level1 30.0 -#property indicator_level2 50.0 -#property indicator_level3 70.0 -#property indicator_levelstyle STYLE_DOT - -#include - -//--- Input Parameters --- -input group "Adaptive RSI Settings" -input int InpPivotalPeriod = 14; // The central RSI period -input int InpVolaShort = 5; // Short period for volatility measurement -input int InpVolaLong = 10; // Long period for volatility averaging -input group "Price Source" -input ENUM_APPLIED_PRICE_HA_ALL InpSourcePrice = PRICE_CLOSE_STD; - -//--- Indicator Buffers --- -double BufferRSI[]; - -//--- Global calculator object --- -CAdaptiveRSICalculator *g_calculator; - -//+------------------------------------------------------------------+ -int OnInit() - { - SetIndexBuffer(0, BufferRSI, INDICATOR_DATA); - ArraySetAsSeries(BufferRSI, false); - - if(InpSourcePrice <= PRICE_HA_CLOSE) - g_calculator = new CAdaptiveRSICalculator_HA(); - else - g_calculator = new CAdaptiveRSICalculator(); - - if(CheckPointer(g_calculator) == POINTER_INVALID || - !g_calculator.Init(InpPivotalPeriod, InpVolaShort, InpVolaLong)) - { - Print("Failed to create or initialize Adaptive RSI Calculator."); - return(INIT_FAILED); - } - - IndicatorSetString(INDICATOR_SHORTNAME, StringFormat("Adaptive RSI%s(%d)", (InpSourcePrice <= PRICE_HA_CLOSE ? " HA" : ""), InpPivotalPeriod)); - IndicatorSetInteger(INDICATOR_DIGITS, 2); - PlotIndexSetInteger(0, PLOT_DRAW_BEGIN, InpVolaLong + InpPivotalPeriod); - - return(INIT_SUCCEEDED); - } - -//+------------------------------------------------------------------+ -void OnDeinit(const int reason) { if(CheckPointer(g_calculator) != POINTER_INVALID) delete g_calculator; } - -//+------------------------------------------------------------------+ -int OnCalculate(const int rates_total, const int, const datetime&[], const double &open[], const double &high[], const double &low[], const double &close[], const long&[], const long&[], const int&[]) - { - if(CheckPointer(g_calculator) == POINTER_INVALID) - return 0; - ENUM_APPLIED_PRICE price_type = (InpSourcePrice <= PRICE_HA_CLOSE) ? (ENUM_APPLIED_PRICE)(-(int)InpSourcePrice) : (ENUM_APPLIED_PRICE)InpSourcePrice; - g_calculator.Calculate(rates_total, open, high, low, close, price_type, BufferRSI); - return(rates_total); - } -//+------------------------------------------------------------------+ -//+------------------------------------------------------------------+