Loading…

Cross To Peak Statistics

"How far does a signal usually run before it's played out" is rarely answered with an actual number - most crossover indicators just mark the cross and leave the rest to the trader's memory. This tool marks each fast/slow SMA cross with an arrow, then tracks price from that cross until it retraces InpReversalPips from the best point reached since - the same idea as a trailing-stop distance - and records how many bars that took and how many points the run covered before exhaustion. Every completed run, separately for bullish and bearish crosses, feeds the on-chart average bars-to-exhaustion and average peak-points figures. A run still open at the most recent scanned bar is deliberately excluded from the stats - its true length is not known yet, and counting it would quietly understate or overstate the average with an unfinished number. A safety cap (InpMaxRunBars) force-closes any run that somehow never retraces, so one freak multi-thousand-bar trend cannot dominate the average. The fast/slow SMA cross is a stand-in base signal - simple and self contained by design - so the exhaustion-measurement machinery is the reusable part. Notes and limitations - Non-repainting: arrows are placed on confirmed crosses using completed bar values, and the statistics table only counts runs that have already finished (exhausted or hit the safety cap) within the scanned window. - The exhaustion distance is a fixed pip value, not a volatility-adaptive one (e.g. ATR-based) - a quiet symbol and a wildly volatile one use the same threshold unless InpReversalPips is tuned per instrument. - The statistics table recomputes once per new closed bar, not every tick. - The fast/slow SMA cross is a placeholder base rule; the exhaustion measurement approach applies to any cross-style signal.

Indicator · MT4 · v1.0 · Free

About Cross To Peak Statistics

Cross To Peak Statistics is an indicator for MetaTrader 4 based on Moving Average. It draws buy and sell arrows on the chart. It has 5 settings, such as Fast period, Slow period and Reversal pips. MQL source code included.

Files in the download: CrossToPeakStatistics.ex4, CrossToPeakStatistics.mq4, CrossToPeakStatistics.txt.

Settings

SettingDefaultWhat it does
Fast period8Fast SMA period
Slow period21Slow SMA period
Reversal pips15Retracement from the run's extreme that counts as exhaustion
Max run bars500Safety cap on bars in a single run before it is force-closed
Stats lookback bars3000How many recent bars are scanned to build the outcome table

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Indicators.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 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: Moving Average · Buy/Sell Arrows · Trailing Stop & Break-even · MT4 Indicator · MQL4 Source Code

MetaTrader 4 & 5 indicators · PolyMaria