Loading…

Mesa Stochastic

A standard stochastic normalises price against its own highest/lowest over a lookback. That works cleanly on a genuinely cyclic instrument, but on anything carrying a real trend the lookback range keeps stretching in the trend's direction, so the oscillator spends long stretches pinned near 0 or 100 instead of cycling through its range - a problem Ehlers calls spectral dilation, because the trend component distorts what should be a pure cycle measurement. The fix Ehlers publishes is to normalise a roofed version of price rather than price itself. The roofing stage is the same two-pole highpass followed by a two-pole SuperSmoother used in this catalogue's standalone Roofing Filter indicator: the highpass removes everything slower than its cutoff (the trend), and the SuperSmoother removes everything faster than its own cutoff (tick noise), leaving a band-limited, roughly zero-mean signal with the trend component already gone before the highest/lowest normalisation ever runs. A final SuperSmoother pass on the raw stochastic ratio removes the stair-step jitter a %K calculation always carries, since the highest/lowest can only change discretely as bars enter and leave the window. Notes and limitations - The roofing stage, the highest/lowest lookback, and the final SuperSmoother pass are all recursive or window-based, so the first several dozen bars after a fresh attach are a warm-up stretch seeded at a flat 50, not a true reading. - The final SuperSmoother stage uses a fixed 10-bar cutoff - Ehlers' published default for this specific stage - separate from InpLowPassPeriod, which only controls the earlier roofing stage. - Because every stage is recursive or a fixed-window lookback with no lookahead, it never repaints: every value shown for a closed bar is final. - Roofing the input reduces spectral dilation, it does not eliminate the underlying problem that any highest/lowest normalisation is comparing against a finite, backward-looking window - a sudden volatility regime change can still distort the reading until enough new bars have entered that window.

Indicator · MT4 · v1.0 · Free

About Mesa Stochastic

Mesa Stochastic is an indicator for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 4 settings, such as High pass period, Low pass period and Stoch period. MQL source code included.

Files in the download: MesaStochastic.mq4, MesaStochastic.txt.

Settings

SettingDefaultWhat it does
High pass period48Roofing filter highpass cutoff (removes trend), in bars
Low pass period10Roofing filter SuperSmoother cutoff (removes noise), in bars
Stoch period20Lookback for the highest/lowest normalisation
AlertstrueAlert once per closed bar on a 20/80 threshold cross

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: Stochastic · Oscillator · Trend · Alerts · MT4 Indicator · MQL4 Source Code

MetaTrader 4 & 5 indicators · PolyMaria