Skip to main content

Time Under Water

Quick Reference

PropertyValue
Dimensionregime
Categorymarket_regime
Versionv0.9.0 (Beta)
Output Columntime_under_water

Time under water - cumulative time since the last peak was reached, in trading hours/minutes

Formula

time_under_water(price, window)

CDM Inputs

ColumnCDM TableDescription
pricecdm_*CDM source table

Parameters

ParameterTypeDefaultDescription
windowinteger [0, 100000]0Window for peak reference (0 = all-time expanding)

Output

Column: time_under_water

Bars (or seconds) since last all-time or rolling peak

Market Intuition & Trading Rationale

Time under water measures the duration since the last price peak: time_under_water(price, window). It's the temporal counterpart to drawdown — drawdown measures how much you've lost, time_under_water measures how long you've been losing. A drawdown of -10% that lasts 3 days is very different from a drawdown of -10% that lasts 3 months.

The duration of drawdowns follows a characteristic pattern: short drawdowns are common and shallow (normal market noise); long drawdowns are rare and deep (bear markets, crashes). When time_under_water extends beyond its historical norms, the market is in an unusual regime — the recovery that normally follows drawdowns isn't materializing.

Time under water is measured in bars (or seconds, depending on the data frequency). On 1-minute bars, a time_under_water of 480 means 8 trading hours — a full session without a new high. This is a powerful signal that the market's character has changed from bullish (regular new highs) to something else.

Usage Cases

  • Drawdown regime classification: Short time_under_water (< 20 bars) = normal correction, expect recovery. Long time_under_water (> 200 bars) = potential regime change — the market isn't recovering on its normal schedule. Reduce long exposure.
  • Mean reversion entry timing: Extreme time_under_water often precedes strong mean reversion. When the market has gone an unusually long time without a new high, the pressure to revert builds — but timing the entry requires confirmation (e.g., time_under_water starting to decline, or price breaking a short-term resistance).
  • Strategy rotation: Short time_under_water (bullish) → trend-following and momentum. Long time_under_water (bearish) → mean-reversion and defensive strategies.

YAML Definition

name: time_under_water
description: Time under water - cumulative time since the last peak was reached, in
trading hours/minutes
category: market_regime
version: v0.9.0 (Beta)
dimension: regime
status: Pre-release
required_inputs:
- price
output_column: time_under_water
output_description: Bars (or seconds) since last all-time or rolling peak
parameters:
window:
type: integer
description: Window for peak reference (0 = all-time expanding)
required: false
default: 0
constraints:
min: 0
max: 100000
formula: time_under_water(price, window)