MEDIAN: Rolling Median
Calculates the rolling non-parametric median (50th percentile) over a specified time window.
@MEDIAN(volume * close, 30) > 10000000 Key Takeaways
- Outlier-resistant metric for liquidity floors and central price tendencies.
- Prevents block deals or single-day volume anomalies from distorting screens.
- Superior to simple arithmetic averages for measuring typical trading liquidity.
What It Means in Simple Terms
The rolling median finds the middle value in a series over the last N days. Unlike the standard average (mean), the median is completely immune to one-off spikes! If a stock trades 10,000 shares every day, but has a single massive block trade of 10,00,000 shares on Tuesday, the average volume jumps through the roof. The median, however, calmly ignores the outlier and reports the true typical volume.
How It Helps You as an Investor
It gives you bulletproof liquidity and turnover screening. In Indian markets where block and bulk deals are frequent, a median liquidity gate ensures you only trade stocks with genuine day-to-day liquidity.
Visual Node Rule Syntax & How to Plug in Values
@MEDIAN(volume * close, 30) > 10000000 Parameter Tuning & Market Calibration
Use a lookback of 20 to 60 days. Rule example: `@MEDIAN(volume * close, 30) > 10000000` requires that the typical daily traded turnover is at least ₹1 Crore, keeping execution slippage low.
Input Fields & Parameters
| Field / Parameter | Type | Default | Role & Description |
|---|---|---|---|
field | field | Required | Historical input price or volume series from market feed. |
timeperiod | int | 30 | Lookback period or tuning parameter for market calibration. |
Mathematical Formulation
The mathematical definition of MEDIAN (Rolling Median) as evaluated within the Saral Engine execution pipeline:
Variable & Parameter Definitions
Sorts the observations in the lookback window of length $n$ and returns the middle observation (or average of two middle values if $n$ is even).
Systematic Strategy Applications
@MEDIAN(volume * close, 30) > 25000000 Require median daily turnover of at least ₹2.5 Crore over the past 30 trading days.
Common Questions & Practical Considerations
Why is the rolling median better than SMA for volume screening?
A single institutional block deal can multiply a 30-day SMA by 5x, misleading your algorithm into thinking a stock is liquid when it is actually illiquid. The median eliminates this risk.