From 1677512d809da91e48da9f6d2ca1418b978dc761 Mon Sep 17 00:00:00 2001 From: Toh4iem9 Date: Fri, 26 Jun 2026 13:46:35 +0200 Subject: [PATCH] refactor: Upgraded with dynamic volume routing to support VWMA Slowing/Signals --- .../MyIndicators/DMIStochastic_Adaptive_Pro.mq5 | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Indicators/MyIndicators/DMIStochastic_Adaptive_Pro.mq5 b/Indicators/MyIndicators/DMIStochastic_Adaptive_Pro.mq5 index a6f6521..3f31fbd 100644 --- a/Indicators/MyIndicators/DMIStochastic_Adaptive_Pro.mq5 +++ b/Indicators/MyIndicators/DMIStochastic_Adaptive_Pro.mq5 @@ -3,7 +3,7 @@ //| Copyright 2026, xxxxxxxx| //+------------------------------------------------------------------+ #property copyright "Copyright 2026, xxxxxxxx" -#property version "1.00" // Initial Release for merged logic +#property version "1.10" // Upgraded with dynamic volume routing to support VWMA Slowing/Signals #property description "DMI Stochastic with Kaufman's ER Adaptive Lookback. Supports Heikin Ashi." //--- Indicator Window and Plot Properties --- @@ -130,8 +130,18 @@ int OnCalculate(const int rates_total, if(CheckPointer(g_calculator) == POINTER_INVALID) return(0); -// Execute the calculation logic (O(1) implementation via calculator) - g_calculator.Calculate(rates_total, prev_calculated, open, high, low, close, BufferK, BufferD); +//--- Determine best volume array (Use Real Volume if available, otherwise fallback to Tick Volume) + long volume_limit = (long)SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_LIMIT); + +//--- Delegate calculations dynamically to support volume-weighted types (VWMA) on Slowing/Signal + if(volume_limit > 0) + { + g_calculator.Calculate(rates_total, prev_calculated, open, high, low, close, volume, BufferK, BufferD); + } + else + { + g_calculator.Calculate(rates_total, prev_calculated, open, high, low, close, tick_volume, BufferK, BufferD); + } return(rates_total); }