Indicators
Read DeMarker from changes in highs and lows

Start with two adjacent bars
Record highs and lows for the current and previous bar. Count the positive increase in the high and the positive decrease in the low separately. Zero out each component if its boundary did not extend. The closing price is not needed for these two comparisons.
Let both extremes expand
Yesterday's range was 100 to 90. Today's range is 103 to 88. The high component contributes 3 and the low component contributes 2. Over this single comparison their relative share on the high side is 0.6. A bullish or bearish body cannot tell you that both components were active.
DeM = ΣDeMax / (ΣDeMax + ΣDeMin)
Add a second comparison
Now use 102 and 89 as the next high and low. Both lie inside the previous range, so this bar adds zero to each component. For a two-comparison window the totals remain 3 and 2. Averaging each component over the same length gives the same ratio as dividing their sums.
Inspect a quiet stretch
To compare with MT5, gather one more candle than the configured period so that the first difference is available. In a run of nested ranges both component sums can reach zero. Flag that window in your worksheet. Classifying such a fallback value as a fresh extreme would confuse missing directional expansion with an actual move.















