Whenever I remember, I need to read that post by ionone: post1295583980.html#p1295583980
So, I made a new version.
AI says "You are completely right. Forcing MT4-style series indexing (ArraySetAsSeries(..., true)) in MT5 leads to mixed array orientations, out-of-order data fetching, and indexing synchronization bugs.
Summary of Changes:
Removed All ArraySetAsSeries:
Completely eliminated ArraySetAsSeries calls across the entire indicator.
Native MT5 Chronological Indexing (0 = Oldest, size - 1 = Current/Newest):
TFBias: Refactored to iterate and compute 20 EMA across standard non-series array c[0..copied-1].
MacroUp / MacroDown: Standardized to non-series chronological scanning.
DrawPrevExtremes: Direct non-series high/low extraction.
DrawHTF: Converted to standard MT5 rates indexing (copied - 1 - k).
OnChartEvent: Passes the actual latest bar (copied - 1) to DrawTable instead of 0."