IP Anchor Section 3a — Signal rules Every parameter, threshold, and rule must be explicitly documented. No ambiguity. This is Section 3a.

What this week covers

A signal is not a hypothesis — it's the operational rule that generates buy/sell decisions. This week teaches three major signal types (z-score, momentum, regression), how to specify entry and exit rules without whipsawing, and how to size positions based on volatility and edge strength.

What Section 3a must contain

  • Signal formula: Exact mathematical expression with all parameters defined. No vagueness like "use a momentum signal." Write: "5-day momentum = (close_t - close_t-5) / close_t-5"
  • Entry rule: The condition under which you enter (signal threshold, crossover, etc.). Example: "Long when momentum > 0.02 and volatility regime is positive."
  • Exit rule: The condition under which you exit (signal reversal, stop loss, take profit, time-based). Example: "Exit long when momentum < -0.01 OR position is held for 30 days, whichever comes first."
  • Position sizing: How large a position as a function of signal strength and risk. Example: "Size = target_vol / realized_vol * capital"

Three signal construction patterns

Pattern 1: Z-score signals (mean reversion)

Z-score measures deviation from the rolling mean in standard deviations.

\[ z_t = \frac{x_t - \mu_{t,w}}{\sigma_{t,w}} \]

Where x_t is price or returns, w is lookback window, μ and σ are rolling mean and std.

Entry rule: Long when z < -2.0 (price is 2 std below average). Short when z > +2.0.

Exit rule: Exit when z crosses zero (price returns to mean). Or time-based: exit after 20 trading days if signal hasn't closed.

Typical use: Pairs trading, commodity mean reversion, currency mean reversion.

Advantage: Simple, easy to interpret. Disadvantage: whipsaws in trending markets.

Pattern 2: Momentum signals (trend-following)

Momentum measures the rate of change in price. EWMAC (Exponentially Weighted Moving Average Convergence Divergence) is the most robust version.

\[ \text{EWMAC}_{f,s} = \text{EWM}_{t,f} - \text{EWM}_{t,s} \]

Where EWM_f is fast (short lookback), EWM_s is slow (long lookback).

Entry rule: Long when EWMAC > 0 and positive regime filter. Short when EWMAC < 0.

Exit rule: Exit when EWMAC crosses zero. Or time-based: exit after 60 days.

Parameters: Fast window (e.g., 8 days), slow window (e.g., 32 days). Use powers of 2 for efficiency.

Typical use: Trend-following in commodities, equities, FX.

Advantage: Captures trends, avoids mean-reversion whipsaws. Disadvantage: lags trend reversals.

Pattern 3: Regression-based signals

Fit a regression model to predict forward returns. Use the fitted value as the signal.

\[ \hat{r}_{t+h} = \alpha + \beta_1 x_{1,t} + \beta_2 x_{2,t} + \varepsilon \]

Where x_i are predictors (fundamental data, alternative data, technical factors).

Signal: Predicted return \(\hat{r}_{t+h}\). Positive = long, negative = short.

Entry rule: Long when \(\hat{r} > \text{threshold}\) (e.g., 0.5% expected return).

Exit rule: Exit when \(\hat{r} < 0\) (expected return turns negative) or after 20 days.

Advantage: Can use multiple factors. Captures fundamental information.

Disadvantage: More parameters, higher overfitting risk. Must test assumptions carefully (Section 3b).

Position sizing

Volatility-targeted sizing (preferred at AlgoGators)

Scale position size inversely to volatility. High volatility → smaller position. Low volatility → larger position. Maintains constant risk contribution.

\[ \text{position size} = \frac{\text{target vol}}{\sigma_t} \cdot \text{capital} \]

Example:

target_vol = 0.10  # 10% annualized target volatility
annual_factor = np.sqrt(252)

realized_vol = returns.rolling(20).std() * annual_factor
position_size = (target_vol / realized_vol) * capital

# When realized_vol is high (20%), size down
# When realized_vol is low (5%), size up

Advantage: Risk contribution is stable across time. Avoids overlevering in calm periods.

Kelly Criterion (rarely used in practice)

Optimal fraction of capital to bet given win probability and payoff ratio.

\[ f^* = \frac{p \cdot b - q}{b} \]

Where p = win probability, q = 1-p, b = win/loss ratio.

Full Kelly is too aggressive. Most funds use half-Kelly or quarter-Kelly.

Regime filters

A regime filter conditions signal execution on market state. Example: only trade momentum when in an uptrend.

Example: Trend filter

\[ \text{regime}_t = \mathbb{1}\left[P_t > \text{EMA}_{t,200}\right] \]

Only execute momentum signals when price is above the 200-day exponential moving average. In downtrends, stay in cash.

Advantage: Reduces drawdowns by avoiding trades in bad regimes. Disadvantage: Misses opportunities at regime transitions.

Chart: Signal timeline example

Price (blue), z-score signal (orange), entry points (green dots = buy, red = sell). Notice the whipsaws: several short-lived entries and exits. This is mean reversion, not ideal in trends.

Section 3a template

SECTION 3A: SIGNAL CONSTRUCTION

3a.1 Signal formula

z_t = (close_t - mean(close_t-20:t)) / std(close_t-20:t)

3a.2 Entry rule

Long: z_t < -1.5 AND regime_t = 1 (positive trend)

regime_t = 1 if close_t > EMA(close, 50), else 0

3a.3 Exit rule

Exit long if: z_t > 0 OR position held for 30 days, whichever first

3a.4 Position sizing

units = (target_vol / realized_vol) * capital / price

target_vol = 0.10 (10% annual target)

realized_vol = 20-day rolling volatility, annualized

Common mistakes

Five signal construction failures

  • Entry and exit rules that create whipsawing. Entering and exiting every few days on noise. Use regime filters or time-holding requirements to stabilize.
  • Not defining parameter values in Section 3a. "Use momentum" is vague. "5-day momentum = (close_t - close_t-5) / close_t-5 with entry at +2% threshold" is precise.
  • Position sizing that doesn't account for volatility. 1 contract in calm markets vs. volatile markets = very different risk. Use vol-targeting.
  • Stop losses at arbitrary round numbers. Stop at 10% loss instead of 2 std-dev move. Round numbers are often support/resistance where slippage is terrible.
  • No exit rule. Every position must have an explicit exit condition. "Hold until I decide" creates uncontrolled risk and decision fatigue.
← Week 6: Data Sourcing Week 8: Model Assumptions →