{
  "id": "sol-stoch-rsi-h4-ema200-v1",
  "frozen_on": "2026-11-12",
  "frozen_before": "Any new SOLUSDT archive ingestion, indicator or performance calculation for this study.",
  "source_plan_library_file_id": "libfile_fde3_f-0e357bed062481918433d2ca5bf35bd1_4aaf69fd96c4819197b87d875abd2c30",
  "question": "Do oversold bullish Stoch RSI 14,14,3,3 crosses with EMA200 provide useful long entries after costs, and how do their counts and results compare with a separately specified RSI14 rebound?",
  "market": "Binance SOLUSDT spot",
  "bar_seconds": 14400,
  "warmup_start_utc": "2020-09-01T00:00:00Z",
  "periods": {
    "full": ["2021-01-01T00:00:00Z", "2026-01-01T00:00:00Z"],
    "early": ["2021-01-01T00:00:00Z", "2023-01-01T00:00:00Z"],
    "later": ["2023-01-01T00:00:00Z", "2026-01-01T00:00:00Z"]
  },
  "retrospective": true,
  "period_scope": "The evaluated SOL study begins in 2021, after a September-December 2020 warm-up. Early and later independent runs have unequal calendar lengths (two and three years). All periods were historical when this protocol was fixed; neither is a prospectively unseen test.",
  "initial_cash": 10000,
  "long_only": true,
  "one_position": true,
  "leverage": 1,
  "uninvested_cash_interest": 0,
  "rsi_length": 14,
  "stochastic_length": 14,
  "k_smoothing": 3,
  "d_smoothing": 3,
  "oscillator_scale": [0, 100],
  "rsi_initialization": "Compute close-to-close changes, gain=max(change,0), loss=max(-change,0). Seed average gain/loss from the first14 changes (15 observed closes); then Wilder alpha=1/14, including every observed change. First source candle has no change and cannot seed RSI.",
  "rsi_formula": "RSI14=100*average_gain/(average_gain+average_loss). If only loss is zero RSI=100; if only gain is zero RSI=0; if both are zero define RSI=50 as an explicit neutral model convention.",
  "stochastic_formula": "raw=100*(current RSI14-lowest RSI14)/(highest RSI14-lowest RSI14) over exactly14 consecutive observed RSI values including current. Missing RSI or an incomplete14-value window gives undefined raw. Equal maximum and minimum gives undefined raw, never fabricated0 or50.",
  "stochastic_smoothing": "K=SMA of current and preceding2 raw values; D=SMA of current and preceding2 K values. Require all3 finite in each consecutive observed window; never skip undefined values. Recompute each short SMA from its window; no cumulative sliding-sum drift. No rounding or epsilon before comparisons.",
  "ema_length": 200,
  "ema_initialization": "SMA of first200 observed closes, then alpha=2/201",
  "atr_length": 14,
  "atr_initialization": "First TR=H-L; SMA of first14 TR, then Wilder alpha=1/14",
  "stoch_candidate": "The previous and current source bars must be adjacent scheduled H4 bars. Previous K<=previous D; current K>current D; current K<20 and current D<20; required K/D values finite and ATR14 positive. Exactly20 fails the oversold requirement. Previous equality qualifies. There is no requirement to wait for a later exit above20.",
  "primary_signal": "When flat at a completed close: stoch_candidate and current close>current EMA200. Exactly equal close and EMA fails. K and D are smoothed stochastic transforms of RSI, not the ordinary price Stochastic.",
  "plain_rsi_candidate": "Adjacent scheduled H4 source bars; previous RSI14<30 and current RSI14>=30; finite RSI and positive ATR14. A separately specified oscillator comparator, not a one-feature normalization-only ablation.",
  "entry": "Immediately next scheduled H4 open times(1+slippage). Missing next source bar or entry outside period cancels signal; no delayed entry.",
  "stop_atr_multiple": 2,
  "target_price_stop_multiple": 2,
  "max_holding_bars": 30,
  "entry_bar_holding_count": 1,
  "exit_levels": "Dprice=2*signal ATR14; stop=entry-Dprice; target=entry+2*Dprice; fixed, positive levels only. Dprice is a price distance, distinct from oscillator D. No EMA, RSI, Stoch RSI or trailing exit.",
  "baseline_fee_per_leg": 0.001,
  "baseline_slippage_per_leg": 0.0005,
  "stress_fee_per_leg": 0.002,
  "stress_slippage_per_leg": 0.001,
  "risk_fraction": 0.01,
  "risk_unit_formula": "entry*(1+fee)-stop*(1-slippage)*(1-fee)",
  "quantity": "min(0.01*available_cash/risk_unit, available_cash/(entry*(1+fee)))",
  "net_pnl": "quantity*(exit-entry)-fee*quantity*(entry+exit)",
  "net_r": "net_pnl/(quantity*risk_unit)",
  "fractional_quantity": true,
  "historical_venue_order_filter_feasibility": false,
  "variants": ["primary", "no_ema", "plain_rsi", "zero_cost", "higher_cost"],
  "variant_rules": {
    "no_ema": "Remove only the current close>EMA200 gate from the identical Stoch RSI candidate. EMA need not be defined for this control; retain ATR, costs and execution.",
    "plain_rsi": "Replace the Stoch RSI candidate with the separately frozen RSI14<30-to->=30 rebound. Keep current close>EMA200, ATR, sizing, costs and exit rules. Trigger, smoothing and threshold all differ, so this is not a causal one-feature ablation or an equal-signal-frequency comparison.",
    "zero_cost": "Primary signal with fee=slippage=0; resimulate prices, quantities, levels and account.",
    "higher_cost": "Primary signal with fee=.002 and slippage=.001; resimulate prices, quantities, levels and account."
  },
  "passive_reference": true,
  "passive_rule": "Full cash buy at first observed in-period opening; sell at last observed close, baseline adverse slippage and fees; exposure/risk not matched to the strategy.",
  "ambiguous_bar_resolution": "Opening barrier checks first. For H4 double touch, scan required official1m candles in chronological order; a missing minute before resolution or a same-minute double touch is unresolved. Primary stop-first; separate target-first bound. Fetch union of required minute days across all portfolios and bounds until no newly required days, or record official unavailability without inventing bars.",
  "gap_execution": "At an observed opening beyond a barrier use that opening reference and adverse sale slippage, before later intrabar range checks.",
  "holding_deadline": "deadline=entry_ts+30*14400. Entry bar counts1. Exit at30th scheduled close; if its quote is missing, first later observed opening after opening-barrier checks and before that later bar's intrabar ranges.",
  "end_exit": "Last observed close inside each independently evaluated period, adverse sale slippage; label period_end.",
  "cash_precision": "Float arithmetic; clamp only residual cash[-1e-8,0) to0; larger negative residual is error.",
  "indicator_gaps": "No synthetic bars. RSI, EMA and ATR recurse over observed bars; Stoch RSI and SMA windows count consecutive observed values, not manufactured time slots. Crosses still require two actual bars adjacent in the H4 schedule; entries require the immediate next scheduled source bar.",
  "reported_close_time": "Retain original close-time metadata and anomalies; close signals available only at scheduled open+14400, never an earlier source metadata close.",
  "first_entry": "Warm-up bar whose scheduled cutoff equals period start may signal first in-period entry; each account starts flat, with no earlier positions.",
  "fresh_signal": "A bar closing after an exit may produce a new signal for the next opening; no intrabar re-entry.",
  "equity_marking": "cash+quantity*native H4 close while open; exit fee at liquidation only. Initial cash included in peak. Equity ts=scheduled close cutoff, bar_ts=source opening; annual attribution uses bar_ts calendar year.",
  "exposure": "Observed evaluated H4 bar occupancy (held at any time in bar), not exact clock time.",
  "diagnostics": {
    "fixed_quantity_costs": "Hold primary raw entry opens, raw exit references, dates and quantities fixed; recost zero/baseline/higher. Report ledger P&L and fees, not resimulated account return.",
    "gap_exclusion": "Flag positions carried over any missing native H4 slot; exclude them at original quantities and report retained ledger P&L, not an account-return improvement.",
    "signal_counts": "Count every valid adjacent Stoch RSI candidate and every separately defined RSI14 candidate whose scheduled signal cutoff (also its next scheduled entry time) lies inside the independently evaluated period, ignoring whether a portfolio is already open. Include a warm-up signal whose cutoff equals period start; exclude a cutoff equal to period end. Record total before EMA, close>EMA, close<=EMA and undefined EMA, plus scheduled next-bar availability. Partition by scheduled decision-cutoff calendar year, explicitly distinct from the native-bar year used for equity returns. These are candidate events, not executable simultaneous trades or false-signal classifications, and need not match portfolio trade counts. Comparing the two triggers does not isolate normalization, equalize thresholds or prove a universal speed advantage. No shadow P&L or candidate portfolio is constructed."
  },
  "gallery": "First completed independent early trade, first completed later trade, then first later trade with opposite P&L sign to first later trade; if none use next chronological later trade. If a cohort has insufficient trades, explicitly report unavailable example rather than invent one. H4 reference markers use raw prices. Selected M15 windows aggregate only complete15-minute groups from real1m observations; refine timing separately, never alter main ledger fills.",
  "later_trade_sample_warning_below": 30,
  "sources": [
    "https://www.tradingview.com/support/solutions/43000502333-stochastic-rsi-stoch-rsi/",
    "https://www.tradingview.com/support/solutions/43000502338-relative-strength-index-rsi/",
    "https://www.tradingview.com/support/solutions/43000502332-stochastic-stoch/",
    "https://github.com/binance/binance-public-data/blob/master/README.md"
  ]
}
