Family Factor Set Without The SMA Gate

Back to leaderboard · 2015-01-01 to 2025-06-01 · v3_top100_monthly

Overall top-100 hits
27.97
average across horizons
Predicted top-100 avg actual rank
232.69
lower is better
Rank IC
0.0657
picks the better of two stocks 52.1% of the time
IC reliability
8.81
t-stat; IC positive 67.5% of months
not adjusted for overlapping windows

Horizon Breakdown

top 100 only
Horizon Average Top-100 Hits Predicted Top-100 Avg Actual Rank Rank IC
3m 27.75 235.43 0.0564
6m 27.86 232.93 0.0706
12m 28.29 229.71 0.0702

Run Note

test summary
Family Factor Set Without The SMA Gate: 27.97 avg hits@100 (3m 27.75, 6m 27.86, 12m 28.29); avg actual rank 232.69; IC +0.0657 (t 8.81).

Run Details

strategy_test_results #89
id
89
strategy_id
strategy_000079
strategy_title
Family Factor Set Without The SMA Gate
strategy_hash
0b2568a1793bccf15ed9c5eda699357ce52f4b26a87cd5200e895a39ebf78d01
evaluator_version
v3_top100_monthly
start_date
2015-01-01
end_date
2025-06-01
created_at
2026-07-25 10:12:30
updated_at
2026-07-25 13:16:44

Sample Top-100 Lists

2020-03-31 / 6m / 30 hits

Predicted top 100

AAL, AAPL, ABBV, ABT, ADBE, ADP, AEE, ALL, AMD, AMZN, ANET, AVGO, AXP, BLK, CAG, CARR, CCL, CDNS, CF, CHTR, CI, CMG, CNC, CRM, CSCO, CVS, D, DAL, DE, DLR, DPZ, DRI, DUK, DXC, ED, ETN, ETSY, FAST, FTNT, GE, GILD, GIS, GOOGL, HAS, HD, HRL, INTC, INTU, ISRG, JNJ, KHC, KLAC, LEN, LIN, LKQ, LLY, LMT, LNC, LOW, MA, MCHP, MCO, MPC, MS, MSFT, NCLH, NEE, NEM, NFLX, NKE, NOW, NVDA, NWL, O, ORCL, OXY, PAYC, PGR, PLD, POOL, PYPL, QCOM, RCL, REGN, RTX, SCHW, SO, SPGI, TER, TMO, TMUS, TSLA, UAL, UNH, URI, V, VRTX, WHR, WMT, XRX

Actual top 100

AAP, AAPL, ABMD, ADBE, ADSK, ALB, ALGN, AMD, AMP, AMZN, APD, APH, APTV, ATVI, AVGO, BBY, BWA, CARR, CDNS, CE, CHRW, CMG, CMI, CPRT, CRM, CTAS, CTLT, CTSH, DD, DE, DHI, DHR, DRI, DXCM, EBAY, EMN, ETSY, EXPE, FCX, FDX, GLW, GPS, HAL, HD, IDXX, IPGP, JCI, KMX, LEG, LEN, LH, LOW, MAS, MCHP, MGM, MOS, NCLH, NKE, NOW, NSC, NVDA, NWS, NWSA, ORLY, PAYC, PH, PHM, PNR, POOL, PVH, PWR, PYPL, QCOM, QRVO, RCL, ROK, ROL, SHW, SIVB, SNPS, SWK, SWKS, SYF, TDG, TEL, TER, TGT, TMO, TSCO, TSLA, TT, UPS, URI, VAR, VIAC, VTR, WHR, WMB, WST, WY

Matched tickers

AAPL, ADBE, AMD, AMZN, AVGO, CARR, CDNS, CMG, CRM, DE, DRI, ETSY, HD, LEN, LOW, MCHP, NCLH, NKE, NOW, NVDA, PAYC, POOL, PYPL, QCOM, RCL, TER, TMO, TSLA, URI, WHR

Strategy Script

0b2568a179
"""Generated V3 stock-ranking strategy."""
from __future__ import annotations

import numpy as np
import pandas as pd


STRATEGY_ID = "strategy_000079"
STRATEGY_TITLE = "Family Factor Set Without The SMA Gate"
DESCRIPTION = """
The 51-57 family all carry an eligibility gate requiring from_200d_ma_pct >=
-0.18. That gate makes roughly 38 percent of the actual top-100 gainers
unreachable, so removing it while keeping every other family weight untouched
should recover a large amount of score.
"""
FACTORS_USED = [
    "return_1m_pct",
    "return_3m_pct",
    "return_6m_pct",
    "return_12m_pct",
    "momentum_12_1_pct",
    "eps_growth_pct",
    "revenue_growth_pct",
    "operating_income_growth_pct",
    "free_cash_flow_growth_pct",
    "operating_margin_pct",
    "free_cash_flow_margin_pct",
    "forward_pe",
    "pe",
    "vol_63d",
    "market_cap",
    "from_52w_high_pct",
    "from_200d_ma_pct"
]
PARAMETERS = {
    "fam_rev_spread": 1.0,
    "fam_growth": 0.77,
    "fam_breadth": 0.27,
    "fam_margin": -0.37,
    "fam_value": -0.48,
    "vol_63d_z": 0.81,
    "fam_size": 0.58,
    "fam_constructive": 0.53,
    "fam_sma": 0.72,
    "fam_steadiness": 0.13,
    "fam_overheat": -0.005
}
COMPLEXITY = 11
PARENT_STRATEGY_ID = "strategy_000054"
GENERATION = 79
RANDOM_SEED = 20260790
CREATED_AT = "2026-07-25T00:00:00+00:00"


def _date_group(df):
    if "trade_date" in df.columns:
        return df["trade_date"]
    return pd.Series(0, index=df.index)


def _rank_pct(df, series):
    """Date-local rank percentile centred on zero; missing values stay neutral."""
    clean = pd.Series(series, index=df.index).replace([np.inf, -np.inf], np.nan)
    ranked = clean.groupby(_date_group(df)).rank(pct=True)
    return ranked.fillna(0.5) - 0.5


def _rank_col(df, column):
    if column not in df.columns:
        return pd.Series(0.0, index=df.index)
    return _rank_pct(df, df[column])


def _zscore_col(df, column):
    if column not in df.columns:
        return pd.Series(0.0, index=df.index)
    clean = df[column].replace([np.inf, -np.inf], np.nan)
    grouped = clean.groupby(_date_group(df))
    mean = grouped.transform("mean")
    std = grouped.transform("std").replace(0, np.nan)
    return ((clean - mean) / std).fillna(0.0)


def _top_half(series):
    """Emphasise only the upper half of a centred rank, leaving the rest flat."""
    return series.clip(lower=0.0) * 2.0 - 0.25


def _turnover(df):
    market_cap = df["market_cap"].replace(0, np.nan) if "market_cap" in df.columns else np.nan
    return _rank_pct(df, df["dollar_volume_21d"] / market_cap)


def _range_252(df):
    return _rank_pct(df, df["from_low_252d"] - df["from_high_252d"])


def _growth_frame(df):
    cols = ["eps_growth_pct", "revenue_growth_pct",
            "operating_income_growth_pct", "free_cash_flow_growth_pct"]
    return df[cols].replace([np.inf, -np.inf], np.nan).clip(lower=-100, upper=300)


def _steadiness(df):
    """Reward growth that is consistent across the four metrics, not one spike."""
    g = _growth_frame(df)
    mean = g.mean(axis=1).fillna(0)
    spread = g.std(axis=1).fillna(0)
    breadth = (g > 0).sum(axis=1) / g.shape[1]
    return breadth - (spread / (mean.abs() + 50)).clip(lower=0, upper=3)


def _overheat(df):
    """Penalise a growth spike that revenue does not support, worse when price is hot."""
    g = _growth_frame(df)
    quality = g[["eps_growth_pct", "operating_income_growth_pct",
                 "free_cash_flow_growth_pct"]].max(axis=1).fillna(0)
    unsupported = (quality - g["revenue_growth_pct"].fillna(0) - 100).clip(lower=0, upper=300) / 100
    explosive = (g.max(axis=1).fillna(0) - 100).clip(lower=0, upper=300) / 100
    hot = (
        (df["return_1m_pct"].fillna(0) > 25).astype(float)
        + (df["return_3m_pct"].fillna(0) > 60).astype(float)
        + (df["from_52w_high_pct"].fillna(-1) > -2).astype(float)
    ) / 3.0
    return explosive * (1 + hot) + 0.7 * unsupported


def _constructive_pullback(df):
    """Distance below the 52-week high, counted only while 6-month return is positive."""
    pull = (-df["from_52w_high_pct"].fillna(0)).clip(lower=0, upper=0.45)
    return pull.where(df["return_6m_pct"].fillna(0) > 0, 0)


def _zscore_series(df, series):
    clean = pd.Series(series, index=df.index).replace([np.inf, -np.inf], np.nan)
    grouped = clean.groupby(_date_group(df))
    mean = grouped.transform("mean")
    std = grouped.transform("std").replace(0, np.nan)
    return ((clean - mean) / std).fillna(0.0)


def _terms(df):
    return {
        "fam_rev_spread": (0.102 * _zscore_col(df, "return_1m_pct") + 0.10 * _zscore_col(df, "return_3m_pct") - 0.12 * _zscore_col(df, "return_6m_pct") - 0.05 * _zscore_col(df, "return_12m_pct") - 0.21 * _zscore_col(df, "momentum_12_1_pct")),
        "fam_growth": (0.55 * _zscore_col(df, "eps_growth_pct") + 0.45 * _zscore_col(df, "revenue_growth_pct")),
        "fam_breadth": (0.55 * _zscore_col(df, "operating_income_growth_pct") + 0.45 * _zscore_col(df, "free_cash_flow_growth_pct")),
        "fam_margin": (0.55 * _zscore_col(df, "operating_margin_pct") + 0.45 * _zscore_col(df, "free_cash_flow_margin_pct")),
        "fam_value": (-0.65 * _zscore_col(df, "forward_pe") - 0.35 * _zscore_col(df, "pe")),
        "vol_63d_z": _zscore_col(df, "vol_63d"),
        "fam_size": _zscore_series(df, np.log1p(df["market_cap"].clip(lower=0).fillna(0))),
        "fam_constructive": _constructive_pullback(df),
        "fam_sma": _zscore_col(df, "from_200d_ma_pct"),
        "fam_steadiness": _zscore_series(df, _steadiness(df)),
        "fam_overheat": _zscore_series(df, _overheat(df)),
    }




def calculate_score(df):
    terms = _terms(df)
    score = pd.Series(0.0, index=df.index)
    for name, weight in PARAMETERS.items():
        if weight:
            score = score + weight * terms[name]
    return score.replace([np.inf, -np.inf], np.nan).fillna(0.0)