Medium Term Weighted Stochastic (STPMT)

Direction, timing, and cycle confirmation - three questions answered by one indicator.

Most momentum oscillators answer one question: is the market overbought or oversold right now? The STPMT - La Stochastique Pondérée Moyen Terme, or Medium Term Weighted Stochastic - was designed to answer three. It tells you the general trend direction, signals when the market is changing direction, and identifies the optimal timing to open or close a position relative to the current oscillation cycle.

Created by French trader and author Eric Lefort in 1999, the STPMT has been a relatively obscure but highly effective instrument among European traders for decades. This implementation by dgtrd brings it to TradingView with full configurability, a Cycle Indicator, a TrendFlex integration for confluence confirmation, and a complete backtest framework.


How STPMT Works

The STPMT is a weighted composite of four Stochastic oscillators, each calculated over a different lookback period and smoothing combination - 5/3, 14/3, 45/14, and 75/20 - with Fibonacci-inspired weights applied to each component. The longer-period stochastics capture medium-term trend direction; the shorter-period ones capture timing and oscillation rhythm. Combined and weighted, the result is a single oscillator that is simultaneously responsive to short-term cycles and anchored to medium-term trend context.

The STPMT oscillates between 0 and 100 like a standard Stochastic, but its behaviour is meaningfully different. The level around which it oscillates - whether it spends more time above or below 50 - indicates the general trend direction. The oscillations themselves, and specifically the crossings of the STPMT line with its moving average, indicate timing. A cross when both the STPMT and its moving average are trending in the same direction is the signal condition.


The Cycle Indicator

The Cycle Indicator is the difference between the STPMT and its moving average - isolating the oscillation component from the trend component. Displayed as a histogram, it makes the rhythm of each cycle immediately visible, helping traders identify both a favourable price level and a favourable moment in time simultaneously. Zero-line crossings of the Cycle histogram mark the timing signals.


TrendFlex Confluence

A TrendFlex Oscillator integration - contributed by the TradingView community and incorporated with permission - adds an adaptive cycle confirmation layer alongside the STPMT. When the TrendFlex oscillator is fully above the STPMT and its average, the uptrend is complete and confirmed. When fully below, the downtrend is confirmed. The TrendFlex adds conviction to STPMT signals and helps traders stay in trending moves longer rather than exiting on minor oscillations.

A ★ confluence label fires when the STPMT cycle crosses zero and the TrendFlex simultaneously agrees on direction - above its midline and rising for bullish confirmation, below and falling for bearish. This is a higher-conviction condition than either oscillator produces alone.


Overbought / Oversold Reference Zones

Configurable overbought and oversold threshold lines mark extreme readings on the STPMT panel. Because the STPMT is bounded 0–100, readings near these extremes indicate potential overextension in the current oscillation - useful as an additional filter for signal quality.


Backtest Framework

The same integrated backtest engine used across the dgtrd toolkit is embedded here, using STPMT cycle zero-line crossings as the entry and exit triggers. Long Only, Short Only, and Both trade modes are supported, with optional reversal on opposite signal, configurable stop loss, candle direction confirmation, and same-bar conflict avoidance. Entry and exit labels, early warning labels, and a floating trade statistics panel all update in real time.


Alerts

Alert conditions fire on STPMT cycle crossings - both the unconfirmed Early Warning and the confirmed Trading Opportunity - for both long and short directions. All alerts include ticker, price, and timestamp.


All four Stochastic component periods, smoothing lengths, and weights are independently configurable. Moving average length, TrendFlex display, overbought/oversold thresholds, and all backtest parameters are fully adjustable.