Changes Made
1. Restricted Inside Bar Detection to Closed HTF Bars
In
!!!-MT5 X-XARDg-INSIDE BAR stops button 1.03.mq5
, we changed the main loop of start2 to only run inside bar detection when i > 0 (completed bars). The live forming bar i == 0 is bypassed for detection and only undergoes signal propagation, ensuring the indicator will never repaint.
2. Restored State History during Recalculations
When prev_calculated > 0, the indicator recalculates a small buffer window (limit = length + 5). Previously, it set len = 0, cutting off active stop lines that had started before that limit. We implemented a backward-search loop from limit + 1 up to limit + length to find any active inside bar and restore the state of len, LastHigh, and LastLow correctly.
3. Safer Signal Propagation
Instead of propagating values from the previous buffer index (HighBuff[bar_now + 1]), which can occasionally contain EMPTY_VALUE if there are history gaps or resets, we now copy directly from LastHigh and LastLow.