OPEN-SOURCE SCRIPT
Bootstrap Confidence Break [forexobroker]

Bootstrap Confidence Break flags bars whose return falls outside a 90 percent confidence interval on the rolling mean return. The CI uses the standard-error formulation that is asymptotically equivalent to the percentile bootstrap when N >= 30, but is fully deterministic — no random number generation, no repainting. Signals fire on EMA cross when the move is statistically significant.
🔶 ALGORITHM
1. r = close - close[1] (single-bar return).
2. mu = sma(r, N); sd = stdev(r, N); se = sd / sqrt(N).
3. CI high = mu + 1.645 * se; CI low = mu - 1.645 * se (90 percent two-sided).
4. Outside-up regime when r > CI_high; outside-down when r < CI_low.
🔶 SIGNAL LOGIC
- Buy: outside-up AND close crosses EMA up AND not already long AND cooldown elapsed AND barstate.isconfirmed.
- Sell: outside-down AND close crosses EMA down.
- Position-lock state machine.
🔶 INPUTS
- Return Window (default 40)
- Pullback EMA Length (default 8)
- Cooldown Bars (default 4)
- Visual: dashboard, glow, EMA toggle, buy / sell colors
🔶 ALERTS
BCB Buy, BCB Sell, BCB Any Signal, BCB Outside Up, BCB Outside Down, BCB EMA Up, BCB EMA Down, BCB 2-Sigma, BCB Webhook JSON.
🔶 LIMITATIONS
- Standard-error CI assumes approximately normal returns; heavy-tailed distributions widen the true tail risk and make this more conservative than a true percentile bootstrap.
- 90 percent interval is a reasonable default; adjust the multiplier (1.645) for stricter or looser cutoffs by editing the script.
- Signal cadence depends entirely on volatility regime; quiet markets produce few outside-CI bars.
- Combining CI break with EMA cross dampens whipsaws but slightly delays entry vs raw CI break.
🔶 ALGORITHM
1. r = close - close[1] (single-bar return).
2. mu = sma(r, N); sd = stdev(r, N); se = sd / sqrt(N).
3. CI high = mu + 1.645 * se; CI low = mu - 1.645 * se (90 percent two-sided).
4. Outside-up regime when r > CI_high; outside-down when r < CI_low.
🔶 SIGNAL LOGIC
- Buy: outside-up AND close crosses EMA up AND not already long AND cooldown elapsed AND barstate.isconfirmed.
- Sell: outside-down AND close crosses EMA down.
- Position-lock state machine.
🔶 INPUTS
- Return Window (default 40)
- Pullback EMA Length (default 8)
- Cooldown Bars (default 4)
- Visual: dashboard, glow, EMA toggle, buy / sell colors
🔶 ALERTS
BCB Buy, BCB Sell, BCB Any Signal, BCB Outside Up, BCB Outside Down, BCB EMA Up, BCB EMA Down, BCB 2-Sigma, BCB Webhook JSON.
🔶 LIMITATIONS
- Standard-error CI assumes approximately normal returns; heavy-tailed distributions widen the true tail risk and make this more conservative than a true percentile bootstrap.
- 90 percent interval is a reasonable default; adjust the multiplier (1.645) for stricter or looser cutoffs by editing the script.
- Signal cadence depends entirely on volatility regime; quiet markets produce few outside-CI bars.
- Combining CI break with EMA cross dampens whipsaws but slightly delays entry vs raw CI break.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
🔵Gain access to our powerful tools : forexobroker.com/tv
🔵Join our free telegram for updates : t.me/dominicwalsfxhtrader
All scripts & content provided by Forexobroker are for informational & educational purposes only.
🔵Join our free telegram for updates : t.me/dominicwalsfxhtrader
All scripts & content provided by Forexobroker are for informational & educational purposes only.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
🔵Gain access to our powerful tools : forexobroker.com/tv
🔵Join our free telegram for updates : t.me/dominicwalsfxhtrader
All scripts & content provided by Forexobroker are for informational & educational purposes only.
🔵Join our free telegram for updates : t.me/dominicwalsfxhtrader
All scripts & content provided by Forexobroker are for informational & educational purposes only.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.