{
  "base_costs": {
    "fee_each_side": 0.001,
    "slippage_each_side": 0.0005
  },
  "benchmarks": "Cash0%; fully invested cash-funded buy-and-hold separately restarted for each period, same base costs, terminal sale. Exposure differs.",
  "control_signal": "Same eligibility and Williams %R entry conditions; remove only C>EMA200. Both use the same 200-bar gate.",
  "cost_model": "Adverse slippage on each entry/exit reference and fees on traded notional. Full reruns for primary/no_filter all3 periods; zero_cost/higher_cost full period. Cash interest zero. Continuous cash ledger. Stop gap can exceed planned1% loss.",
  "direction": "long_only",
  "entry": "Enter only at next scheduled H4 observed open; cancel if missing or outside period. E=O*(1+s). The later close-time metadata of that entry bar never censors an otherwise available opening. Reject an entry if its fixed stop is not strictly below the raw available opening (require 0<SL<O); this check uses only known opening and signal values.",
  "equity": "At each observed H4 close, cash+q*C*(1-s)*(1-f); opening peak includes initial cash. Maximum drawdown sampled at H4 closes, not intrabar.",
  "example_selection": [
    "first chronologically completed early primary trade; unavailable if none",
    "first chronologically completed later primary trade; unavailable if none",
    "first later primary trade with strictly opposite net P&L sign to first later primary trade (positive versus negative only; zero has no opposite sign); unavailable if no such trade, with no outcome-selected substitute"
  ],
  "exit": "At an observed bar open, stop-gap (O<=SL) first; queued %R exit next; a previously missed 30-interval deadline next. Then intrabar stop if L<=SL; then surviving 30th scheduled close/time or period-end close. A valid completed close with %R>=-20 queues exit for next scheduled open, including a close on the entry interval. If queued exit open missing, execute at first observed open with stop-gap priority; flag delayed exit. Entry interval counts as 1. A new close signal after an exit may queue the following open. The oscillator exit is a level condition, not a requirement for a new crossing. Once queued it remains pending until the position exits; an unavailable later reading does not revoke it. The time deadline is entry_open_time+30*14400 seconds, counting scheduled intervals, including missing observations, rather than 30 observed bars. If a terminal scheduled close cannot be observed, use the first subsequent observed opening under the declared priorities; period-end uses the last available observed close within the period and reports that event timestamp.",
  "exposure": "Observed-interval occupancy proxy: count each observed evaluation bar during which a position was already open at its opening or was opened on that bar, including an exit-at-open bar, divided by observed evaluation bars. This is not elapsed-time or capital-weighted exposure; missing intervals and the unknown intrabar stop time prevent an exact time exposure estimate from these candles.",
  "float_arithmetic_review": "Canonical replay uses Python binary64 for EMA/ATR, math.fsum for the 200-close EMA and first14-TR ATR mean seeds, EMA update alpha*C+(1-alpha)*previous with alpha=2/201, and ATR update (13*previous+TR)/14. Original-price-scaled integer Williams threshold comparisons remain exact. Independent Decimal(40) rebuild compares discrete decisions exactly; absolute tolerance 1e-6 USDT account amounts, 1e-8 price/indicator/dimensionless values, 1e-12 ETH quantities. Any discrepancy is documented and corrected without retuning strategy parameters.",
  "frozen_at_utc": "2026-11-14T09:27:24.080302+00:00",
  "higher_costs": {
    "fee_each_side": 0.002,
    "slippage_each_side": 0.001
  },
  "holding_limit_intervals": 30,
  "id": "mpf-ethereum-h4-williams-r-ema200-20261114-v1",
  "indicators": {
    "atr14": "First canonical bar in a restarted segment has TR=H-L; seed ATR with first14 TR, then (13*previous+TR)/14. Subsequent TR=max(H-L,abs(H-Cprev),abs(L-Cprev)).",
    "ema200": "Close EMA200, mean seed at the 200th consecutive canonical observation, then alpha=2/201 and EMA=alpha*C+(1-alpha)*EMA_previous. Full-precision arithmetic; strict close>EMA comparison without displayed rounding.",
    "reset": "A missing scheduled H4 observation or noncanonical source-close row ends the segment. Retain noncanonical rows as raw evidence but calculate no indicators on them; restart on the next canonical bar. Both primary and no-EMA control require at least 200 consecutive canonical observations at the current signal candle, positive current ATR14, and available current and immediately previous Williams %R readings in that segment. The prior %R candle need not itself satisfy the 200-bar eligibility gate.",
    "williams_r14": "WR=-100*(HH14-C)/(HH14-LL14), including the current canonical candle. If HH14=LL14, WR is unavailable; no crossing or oscillator exit can be generated from an unavailable reading. This alone does not reset EMA/ATR. For exact -80/-20 comparisons, parse original price strings as integers scaled by 100000000; compare integer numerator=-100*(HH14_int-C_int) against threshold*denominator. Store the real quotient for display; displayed rounding is never used for a signal. Verify that original prices are exactly representable on the stated scale. An unavailable immediately previous reading blocks a crossing on the current candle; do not bridge across it."
  },
  "initial_cash": 10000,
  "instrument": "Binance ETHUSDT spot",
  "leverage": false,
  "max_positions": 1,
  "missing_and_partial_path": "No interpolation. Existing positions keep their original stop across gaps/noncanonical intervals; actual available openings/ranges drive fills. Trades exposed to a missing/noncanonical H4 interval are flagged even if closed before metadata is known. Missing prices can conceal paths; exclusions at original quantities are diagnostics, never rebuilt account returns.",
  "net_r": "Net realized P&L divided by frozen entry q*Lunit. Profit factor gross positive net-trade P&L / absolute negative net-trade P&L, undefined without losses.",
  "period_restarts": "Periods are [start,end), separately cash-funded and initially flat, with no position carried from another run. Indicators retain the continuous preperiod warmup history (since 2019-06-01, subject to segment resets), rather than restarting at each account start. A valid close signal on the immediately preceding scheduled H4 candle may enter at the first period opening. If that scheduled opening is missing, cancel it; never carry a preperiod pending exit or position. No new entry is scheduled at or after end.",
  "periods": {
    "early": [
      "2020-01-01T00:00:00Z",
      "2023-01-01T00:00:00Z"
    ],
    "full": [
      "2020-01-01T00:00:00Z",
      "2026-01-01T00:00:00Z"
    ],
    "later": [
      "2023-01-01T00:00:00Z",
      "2026-01-01T00:00:00Z"
    ]
  },
  "position_size": "Lunit=E*(1+f)-SL*(1-s)*(1-f); q=min(0.01*cash/Lunit,cash/(E*(1+f))). Continuous fractional quantity; venue historical lot/notional rules not reconstructed. Flat account pre-entry equity equals cash.",
  "price_precision": "Single stop touch identifies the observed H4 interval, not a tick timestamp. Signal/time/period exits use stated completed-close or opening prices. Scheduled availability is open+4h even for noncanonical source closes. A noncanonical row close used by a scheduled time/period liquidation is an explicitly flagged stale/partial-close proxy, not a demonstrated executable fill.",
  "primary_signal": "At a completed canonical H4 close when flat, require eligibility, previous %R<=-80<current %R, current %R<-20 and C>EMA200. Previous reading must exist in the same contiguous canonical segment; comparisons are unrounded. An entry crossing that already reaches the exit region is rejected.",
  "research_status": "Retrospective, already familiar historical data. Dates and this specification fixed before computing this Williams %R strategy. No parameter search, optimization, or prospective unseen-test claim.",
  "risk_fraction": 0.01,
  "site_baseline": {
    "existing_strategy_count": 58,
    "version": 332
  },
  "sources": [
    "https://www.tradingview.com/support/solutions/43000501985-williams-r-r/",
    "https://github.com/binance/binance-public-data/blob/master/README.md"
  ],
  "status": "frozen_before_first_calculation_of_this_strategy",
  "stop": "Fixed SL=E-2*ATR14_signal; no trailing and no profit target. Reject nonpositive stop.",
  "timeframe_seconds": 14400,
  "warmup_start": "2019-06-01T00:00:00Z"
}
