{
  "study": "GBP/USD H4 Elder-Ray13 separate Bulls/Bears Power",
  "status": "frozen before first strategy indicator/performance calculation",
  "symbol": "GBPUSD",
  "timeframe_seconds": 14400,
  "warmup_start": "2019-01-01T00:00:00Z",
  "periods": {
    "full": [
      "2020-01-01T00:00:00Z",
      "2026-01-01T00:00:00Z"
    ],
    "early": [
      "2020-01-01T00:00:00Z",
      "2023-01-01T00:00:00Z"
    ],
    "later": [
      "2023-01-01T00:00:00Z",
      "2026-01-01T00:00:00Z"
    ]
  },
  "research_scope": "Retrospective fixed-rule demonstration using preset Elder-Ray13. Archived history is familiar from prior research; this split is not an unseen prospective test. No parameter search over lengths, signs, stops, costs or periods. Publish every frozen scenario regardless of result.",
  "source": {
    "provider": "HistData Generic ASCII M1 Bid",
    "raw_directory": "data/gbpusd-pivots/raw",
    "manifest": "data/gbpusd-pivots/manifest.json",
    "timestamp": "Fixed EST UTC-05 with no DST; add18000seconds forUTC. The separate NewYork trading-week/financing calendar observes DST.",
    "normalization": "Validate pinned SHA256 and ZIP CRC; one GBPUSD CSV peryear. Sort actual UTC minutes. Collapse only byte-identical rows at an identical source timestamp, reject conflicts. Retain all original ZIPs. Ignore placeholder volume. No fabricated or interpolated minutes. Trim to warmupStart<=t<2026-01-01UTC.",
    "h4": "Buckets floor(UTCepoch/14400), first actual Bid open/maxhigh/minlow/lastactualclose. Retain partial buckets and their first/last observed minutes. Indicator close becomes a disclosed stale-price proxy if final minute absent; available only at scheduled H4 cutoff. No future bucket ranges or metadata gate an already observed opening.",
    "indicator_history": "EMA/ATR recursion continues over all observed H4 buckets, including partial buckets and scheduled gaps/weekends; no artificial candles or gap reset. Raw setup comparisons for BOTH entries and indicator exits require previous/current observed H4 anchors exactly14400seconds apart.",
    "source_authenticity": "Reuse seven original GBPUSD ZIPs by exact basename and SHA256 identity. Retained source manifest paths document original historical download location data/eurusd-bb-squeeze/raw; current reusable copies reside under data/gbpusd-pivots/raw. Local pinned bytes, not newly downloaded or provider-published checksums."
  },
  "indicators": {
    "ema13": "EMA13 on observed Bid closes; arithmetic-mean seed of first13 observations, then alpha2/14=1/7. Firstdefined index12. Recursions continue over all observedH4 including partialbuckets and scheduledgaps; no invented observations or Mondayreset.",
    "bulls": "BullsPower_t=BidHigh_t-EMA13_t. Price difference in USD perGBP, not percentage, volume, actual order flow, or a bounded oscillator.",
    "bears": "BearsPower_t=BidLow_t-EMA13_t, using the SAME close-basedEMA13. Plotbothseparately in pips bydividing0.0001; donotsum thepair. Bulls-Bears=High-Low.",
    "atr14": "Wilder ATR14: firstTR=H-L; thereaftermax(H-L,abs(H-prevObservedClose),abs(L-prevObservedClose)). Seedmeanfirst14TRs, then(13*previousATR+TR)/14. Firstdefinedindex13.",
    "numeric_decisions": "Indicator recursion and rawsetup/EMAslope predicates use Decimal40, ROUND_HALF_EVEN, exact sourceintegerprices/1e6. Independentindicatorrebuild uses Decimal50. Indicatorvalues are castonce to binary64 for modeledexecution,accountamounts,chartsandJSON; the stored rawflags/slope drive signals without displayrounding or epsilon. Execution and cash arithmetic use binary64 except exact realizedper-unit PnL identity described below. Exact discrete decisions must match independent verification.",
    "raw_setups": "With current/previousEMA/Bulls/Bears defined and adjacentH4anchors: rawLong=(Bears_t<0 AND Bears_t>Bears_prev); rawShort=(Bulls_t>0 AND Bulls_t<Bulls_prev). These booleans are computed independently ofATR,EMAslope,flatstate and entryconflict suppression."
  },
  "entry": {
    "setups": "Whileflat, first reject BOTH rawLong andrawShort true asambiguous. Otherwise rawLongselectslong/rawShortselectsshort; neitherselectsnone. Previous/currentH4mustbeadjacent; currentATR14positive.",
    "slope_gate": "Primarylong additionallyEMA13_t>EMA13_prev, shortEMA13_t<EMA13_prev. Equalityfails. No_slopecomparator removesONLY thisentrygate; sharesrawbothconflictrejection,ATR/dataeligibility,exits,costs,sizing. Zero_cost/higher_cost useprimarysignals.",
    "execution": "At immediately nextscheduledH4opening, requireactualM1openingexactlyatthatUTCtimestamp insideperiodandweeklysession. Missingexactminutecancelsentry, eveniflaterminuteexists. Longfill=sourceBidOpen+scenarioSpread+slip; shortfill=sourceBidOpen-slip.",
    "eligibility": "Only enter during [Sunday17:00,Friday17:00) America/New_York modelweeklysession. Retainpreviousindicatorhistory acrossperiodrestart, but restartcashandpositions. No same-openingreentryafteropening/intraminuteexit; a completedpreviousminutecloseexit allowsfreshH4decisionatsamecutoff.",
    "position": "Oneposition, noadding/reversal/hedge. FractionalGBPquantity; nohistoricalminimumlot/step schedule reconstructed."
  },
  "account": {
    "initial_cash": 10000,
    "risk_fraction": 0.01,
    "notional_cap": "Entry GBPnotional+entrycommission<=preentryUSDcash, for either direction; no leverage at entry. USD collateral/mark-to-market research account, not actual delivery of GBP or a broker margin schedule.",
    "planned_loss": "D=2*signalATR14. Lunit=D+exitSlippage+2*commissionUSDperGBP. q=min(0.01*B/Lunit,B/(abs(entryFill)+commissionUSDperGBP)). Nominal stop budget excludes future unknown holdingcharges and opening gaps.",
    "net_r": "Realized directionalpricePnL minus bothcommissions and realizedfinancing, divided by entryq*Lunit. Nominal1%budget is not guaranteed maximum loss.",
    "cash_guard": "Require positivefinitepreentryUSDcash andpositivefinitequantity. Ifcash<=0, skipnewentriesbutcontinueequitymarks/accounting; no negativeunits. Noresult-dependent parameterchange.",
    "exact_realized_pnl": "Construct Decimal scenario costs DIRECTLY from protocol decimal inputs: Decimal(str(protocolSpreadPips))*Decimal('0.0001'), Decimal(str(protocolSlippagePips))*Decimal('0.0001'), Decimal(str(protocolCommission))/Decimal(100000), Decimal(str(protocolCarryPips))*Decimal('0.0001'), never from pre-multipliedbinary64 costs. For opening/close liquidation includingstopgaps: unit=d*(exitSourceBidInt-entrySourceBidInt)/1000000 - spread - 2*slip - 2*commission - carry*rolloverUnits. For intraminutestop: unit=-Decimal(str(2*modeledSignalATR))-slip-2*commission-carry*units. Multiply by modeledquantity after exactunitcalculation. An exactzero unitmeans exactzeroPnL; no classificationepsilon or resultdependentthreshold."
  },
  "exit": {
    "fixed_stop": "LongSL=entryFill-2ATR; shortSL=entryFill+2ATR, positivefinite. For long requireSL<entryBidOpen; forshort requireSL>modeledAskOpen. No target, trailingstop or stopupdates.",
    "quote_side": "Longexittrigger/sourcequoteBid; shortexittrigger/modelAsk=Bid+scenarioSpread. Exitfill=exitReference-direction*slip.",
    "indicator_level": "Afterentry, longposition queuesexitwhenrawShort=true; shortpositionqueueswhenrawLong=true, irrespectiveEMAslope. AdjacentH4requiredtorawsetupcomparison. No currentATRrequirement, no newzero-crossing. BOTHrawsetups true suppressesonlyflatentry; itstilltriggerstheoppositerawexitforanexistingholding. CompletedsetupavailableatscheduledH4cutoff; pendingexitusesthefirstobservedM1openingat/aftercutoffwithstopgappriority. Queuepersistsmissingquotes. Sameexitpredicateforallvariants.",
    "order": "At each observedminuteopening: openingstopgap first, then pendingindicator exit, then overdue earliestdeadline; onlythen inspect subsequentminuterange forstop. Stopgap uses actualopeningreference. IntraminutestopusesSLreference. No imaginedticktime.",
    "deadlines": "Earliest of entry+30*14400 calendarseconds, nextFriday17:00 America/New_York, evaluatedperiodEnd. Stop checks in minutesbeforedeadline precede modeleddeadlineclose. If an observedminute ends exactlyatdeadline, survivingposition exits at that minuteclose afteritsrangechecks; otherwise use firstlater observed opening with openingstopgap priority. Pendingindicatorqueue earlierthandeadline doesnot waitfor modeleddeadlineclose. Periodend neverreads out-of-periodopening: lastobservedinperiodclose fallback explicitlyflagged if exactdeadlineclose unavailable. Ties afterstop/queue use time,thenweek_close,thenperiod_end.",
    "timing": "Openingevent exact observedminuteopening; modeledminuteclose at minuteStart+60; intraminute stop interval[minuteStart,minuteStart+60), not an exacttick. Indicator exits use completedH4information only.",
    "max_holding_h4_slots": 30
  },
  "pip_size": 0.0001,
  "costs": {
    "baseline": {
      "spread_pips": 1.5,
      "slippage_pips_per_leg": 0.1,
      "carry_pips_per_rollover_unit": 0.2,
      "commission_usd_per_100000_gbp_per_leg": 3.5
    },
    "higher_cost": {
      "spread_pips": 3.0,
      "slippage_pips_per_leg": 0.2,
      "carry_pips_per_rollover_unit": 0.4,
      "commission_usd_per_100000_gbp_per_leg": 7.0
    },
    "zero_cost": {
      "spread_pips": 0,
      "slippage_pips_per_leg": 0,
      "carry_pips_per_rollover_unit": 0,
      "commission_usd_per_100000_gbp_per_leg": 0
    },
    "scope": "Fixed research scenarios, not measured historical or current broker spreads/fees. AskOHLC=Bid+constantspread; actualAsk unobserved. Fullrerunrebuildfills,stops,quantities,calendar,cash.",
    "financing": "Bothdirectionsresearchdebit atMonday–Friday17:00 America/New_York: Wednesday3units, otherweekdays1; noholidaycalendar or credit. Entrytime<cutoff and position stillopenaftercutoff. Exactopen/closeexit atcutoff excludesit; intraminuteexitwhoseintervalstart=cutoff includesit. Entryatcutoff excludesit. Accrue in equity and deductin netPnL."
  },
  "variants": [
    "primary",
    "no_slope",
    "zero_cost",
    "higher_cost"
  ],
  "runs": [
    "primary_full",
    "primary_early",
    "primary_later",
    "no_slope_full",
    "no_slope_early",
    "no_slope_later",
    "zero_cost_full",
    "higher_cost_full"
  ],
  "equity": "At each observedH4scheduledcutoff, settle actualexits beforecutoff or atcutoff ifmodeledclose. An openingexit exactlyatcutoff remainsheld in precedingclosemark. Ifopen: V=preentryCash+direction*q*(liquidationFill-entryFill)-2*q*commissionUSDperGBP-q*carryUSDperGBPPerUnit*accruedRolloverUnits; liquidationFill=BidClose-slip long or BidClose+spread+slip short. If flat, use realizedcash. Initial10000isopeningpeak. Annualreturns chainyearendmarks anduse bucketopeningyear. H4sampling is not continuous drawdown.",
  "exposure": "Count observedH4buckets with any positioninterval overlap; exactopeningexit doesnot occupy itsfollowingbucket, intraminuteexitdoes. Denominator observedbuckets only; not exactwallclockexposure. Holding H4equivalents are elapsedcalendartime, within1mbarrier haslower/upperbounds.",
  "quality": "Keepallgaps. Separate modelSunday17-toFriday17NYinsessionunobservedminutes fromoutsideweeklysessions withoutclaimingfeedfailurevsnoupdates/holidays. Flagtradescrossingunobservedinsessionminutes and partialsignal/exitbuckets. Ex-post exclusion atoriginalquantities is ledgerdiagnostic only, not realtimefilter or rebuiltretrun.",
  "gallery": "First completedprimaryearlytrade; first completedprimarylatertrade; then firstlatertrade with strictlyoppositenetPnLsign (zeronotopposite), otherwise nextlatertrade, otherwiseexplicitunavailable. Outcomeconditionedthirdexample is educational,notrepresentativesample; examples alreadybelongtoaccounttotals. H4pricecharts sourceBid; forshort markersdistinguishmodeledAskexitreference from Bidcandles.",
  "reference": "USDcash10000withzeroassumedinterest; do not rankleveraged/short FX against buy-and-holdasriskmatched.",
  "verification": {
    "independent_decimal_precision": 50,
    "money_absolute_tolerance": 1e-06,
    "price_indicator_tolerance": 1e-08,
    "metrics_tolerance": 1e-08,
    "decisions": "Exact rawsetupbooleans,EMAslopesigns,conflictflags,counts,times,sides,eventkinds,qualityflags. Numeric tolerancesneverchange thresholds.",
    "canonical_decimal_precision": 40,
    "quantity_gbp_tolerance": 1e-07
  },
  "sources": [
    "https://www.tradingview.com/support/solutions/43000717955-bull-bear-power/",
    "https://www.histdata.com/f-a-q/data-files-detailed-specification/"
  ]
}
