Skip to content

Indicators

A technical indicator is a function that transforms raw OHLCV price data into a time series of numbers. In MarketHeist, indicators are the first half of a strategy: they measure some aspect of price behavior, and a position rule converts that measurement into a long/flat signal.

How indicators are applied

For each backtest, MarketHeist:

  1. Fetches OHLCV data for the configured ticker and frequency.
  2. Runs the selected indicator on the full OHLCV series, producing a value at each bar.
  3. Applies the position rule to the indicator values to determine whether the strategy is long (invested) or flat (cash) on each bar.
  4. Simulates returns assuming end-of-bar execution (no lookahead bias within a bar).

Indicator values during the warm-up period — the initial bars needed to compute the first valid value — are treated as NaN and the position rule defaults to flat during that window.

TIP

To learn how position rules translate indicator values into long/flat signals, see Position Rules.

Built-in indicators

Trend & momentum

IndicatorDescription
SMA CrossoverRatio or difference between a fast and slow simple moving average. Goes long when the fast SMA is above the slow SMA. Configurable windows (e.g., 20/50 days).
EMA CrossoverSame logic as SMA Crossover but uses exponential moving averages, which weight recent prices more heavily. Reacts faster to trend changes.
P/MA MomentumPrice divided by its own N-day moving average. Values above 1.0 indicate price is above the trend line; values below 1.0 indicate below. Simple, interpretable momentum proxy.
SlopeLinear regression slope of closing price over a lookback window, normalized by price level. Positive slope = uptrend; negative = downtrend.
CurvatureSecond derivative of price (rate of change of slope). Captures acceleration and deceleration of trends. Useful for detecting trend exhaustion.
ADXAverage Directional Index — measures the strength of a trend without indicating direction. High ADX (>25) indicates a strong trend; low ADX (<20) indicates a ranging market. Typically used as a filter alongside a directional indicator.

Mean-reversion & oscillators

IndicatorDescription
RSIRelative Strength Index (0–100). Values above 70 are conventionally "overbought"; below 30 are "oversold." In a trend-following configuration, RSI > 50 can signal continued upside.
CCICommodity Channel Index. Oscillates around zero; large positive values indicate price is far above its moving average (potential overbought); large negative values indicate far below.
Stochastic%K oscillator (0–100) comparing closing price to the high-low range over a lookback window. Often smoothed with %D. Values near 100 indicate price closed near the top of the recent range.
Bollinger BandsWidth or %B of Bollinger Bands (price position within ±2σ bands). %B above 1.0 means price is above the upper band (breakout signal); %B below 0.0 means price is below the lower band.

Volume & volatility

IndicatorDescription
OBVOn-Balance Volume — cumulative volume adding up-days and subtracting down-days. Rising OBV alongside rising price confirms trend; divergence signals potential reversal.
ATRAverage True Range — average of true range (max of high-low, high-prevclose, prevclose-low) over N days. Measures volatility in price units. Useful as a position-sizing input or for filtering low-volatility regimes.
Volatility RatioShort-term ATR divided by long-term ATR. Values above 1.0 mean recent volatility is elevated relative to baseline. Can be used to go flat during high-volatility regimes.
VWAP DeviationDeviation of closing price from the rolling Volume Weighted Average Price, expressed as a percentage. Positive values mean price is above VWAP; negative means below.

Custom indicators

You can write your own Python indicator using the compute(df, params) contract. See Custom Indicators for the full specification and an example.

MarketHeist Backtest Engine