Hi Xard!
Version 3.08 of XU EFFECT isn't working here. When I try to put it on the chart I get the following message: "array out of range in 'XU EFFECT_3.08.mq5'.
Thank you for this Trading System.. looks great.
Hi Xard!
It's because for some reason M5 is not included in period multiplication function, it starts from M4 to M1jp303 wrote: Thu Feb 19, 2026 6:36 am Hi guys, first post on here so not sure if images will load but is my MT5 playing up? Or is this normal? My m5 doesnt make any sense - The m1,m3,m4, all have the HLEMA miles away as well as 15,30m etc but on the 5m its following price much more closely.
Code: Select all
else if(_Period <= PERIOD_M4)
{
EMA16Period = 336;
Print("M4 timeframe: EMA period = ", EMA16Period);
}Code: Select all
Changelog: XU_EFFECT_v3.11 Optimization & Refactoring
🚀 Performance Optimizations
Bulk Data Access
Moved CopyBuffer logic for SEMA (Fast/Slow) and RSI out of the main OnCalculate loop.
Implemented bulk copying of data only for the necessary range (limit to rates_total), significantly reducing API overhead.
Fast Time Computations
Optimized IsTradingGap to check for simple "period-sized" gaps first (t2 - t1 == PeriodSeconds()). This bypasses slow TimeToStruct calls for 90%+ of candles.
Variable Caching
Replaced repetitive GetSymbolEpsilon() calls with a single global variable g_FloatEpsilon calculated once in OnInit.
Optimized Array Access
Replaced safe but slow SafeArrayGet with direct array access (buffer[i]) in inner loops where index validity is already guaranteed.
Lazy Initialization
Removed massive ArrayInitialize calls in OnInit that were zeroing out entire buffers unnecessarily.
UI Throttling
Implemented a throttle mechanism in UpdateSovereignDisplay to limit UI redraws (default: 10 FPS), preventing chart lag during high-frequency ticks.
🐛 Bug Fixes & Logic Corrections
Ternary HUD Confidence Logic
Issue: Original code (v3.08) capped confidence at 1 using MathMin because VWAP/RSI inputs were binary.
Fix: Rewrote logic to sum the agreements. Now the HUD correctly displays confidence as "1/3", "2/3", or "3/3".
"Disappearing HUD" Race Condition
Issue: HUD elements sometimes vanished when switching timeframes.
Fix: Added explicit ObjectsDeleteAll and ChartRedraw in OnInit to ensure a clean slate, plus a forced redraw in EnsureUIExists.
Invalid Historical Calculations
Issue: Original code used iClose(Symbol, Period, shift) inside the loop, which uses 0=newest indexing, while OnCalculate uses 0=oldest. This caused calculations to use future data or incorrect bars.
Fix: Refactored CalculateSEMABias and GetHybridTernaryBias to accept price as an argument, passed directly from close[i]. This is both faster and correct.
🧹 Code Structure & Cleanup
Modular Organization
Grouped related functions into labeled sections:
CORE SYSTEM
CALCULATION ENGINES
UI & DISPLAY SYSTEM
DATA MANAGEMENT
UTILITIES
Consolidated Definitions
Moved all #define macros, constants, and global variables to the top of the file for better readability.
Standardized Headers
Added consistent ASCII art headers to all function blocks for easy navigation.
Syntax Corrections
Fixed minor syntax errors (like missing function signatures) that were introduced during manual editing.Thats great, thanks. I must have missed this if it was previously mentioned. This is a huge help!budhi1976 wrote: Thu Feb 19, 2026 4:32 pm It's because for some reason M5 is not included in period multiplication function, it starts from M4 to M1
You need to edit the mq5 file and change period.
Search for this line of codeand change PERIOD_M4 to PERIOD_M5 also change "M4 timeframe..." to "M5 timeframe..."Code: Select all
else if(_Period <= PERIOD_M4) { EMA16Period = 336; Print("M4 timeframe: EMA period = ", EMA16Period); }