Loading…

Streak State Indicator

"Five bars up in a row" is not the same statement on every symbol. On one instrument a five-bar up-streak is unremarkable; on another it is the longest run seen in months. This indicator puts a number on that comparison instead of leaving it to feel. Each bar's close is compared to the previous bar's close: higher extends (or starts) an up-streak, lower extends (or starts) a down-streak, and an exactly equal close carries the running streak forward unchanged. The result is a signed running count plotted as a histogram - positive for an up-streak, negative for a down-streak, and its absolute value is the streak's current length in bars. Separately, on every tick, the indicator scans the trailing InpLookbackBars window for every COMPLETED streak of the same direction as the live one (a streak "completes" the moment the run breaks), and reports what percentage of those completed streaks were no longer than the current one. A live 5-bar up-streak reported at the 90th percentile means only 10% of this symbol's completed up-streaks in the lookback window ran 5 bars or longer - a genuinely stretched run for this instrument, not just "five" in the abstract. Notes and limitations - The percentile is read against completed streaks of the SAME direction only - an up-streak is never compared against historical down-streaks, since the two are not necessarily symmetric on a trending instrument. - Needs InpLookbackBars + 2 bars of history before the histogram and percentile comment become available; it returns 0 (no data) before that. - A flat run of exactly-equal closes neither extends nor breaks a streak - it is rare on live tick data but can occur on a thinly quoted symbol or synthetic feed. - The on-chart Comment() is cleared automatically when the indicator is removed from the chart.

Indicator · MT5 · v1.0 · Free

About Streak State Indicator

Streak State Indicator is an indicator for MetaTrader 5. It has 2 settings, such as Lookback bars and Show comment. MQL source code included.

Files in the download: StreakStateIndicator.ex5, StreakStateIndicator.mq5, StreakStateIndicator.txt.

Settings

SettingDefaultWhat it does
Lookback bars500Bars scanned to build the historical streak-length distribution
Show commenttruePrint the percentile read-out in the top-left chart corner

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Indicators.
  3. Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
  4. Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the indicator from the Navigator onto a chart and adjust the settings.

Download the PDF guide

Tags: Trailing Stop & Break-even · MT5 Indicator · MQL5 Source Code

MetaTrader 4 & 5 indicators · PolyMaria