A good weather forecaster doesn't just predict tomorrow's weather. They tell you HOW SURE they are. "70% chance of rain" is far more useful than "it might rain". The number lets you decide whether to bring an umbrella, change plans, or ignore it.

Trading signals work the same way. A direction is only half the story; the other half is confidence — how strongly should you act on this call? DahabPro's engine produces both together. To get the confidence right, the engine first has to figure out what kind of market it's in. That's regime detection.

Regime detection in code

The engine watches several regime markers in parallel:

  • Trend strength — Are SMAs stacked? Is price following them? Is the 50-200 spread widening or narrowing?
  • Volatility regime — Is ATR rising or falling? Are Bollinger Bands squeezing or expanding?
  • Cross-asset alignment — Do oil, equities, and gold move together (risk-on/off) or independently?
  • Macro stance — Are real yields/dollar/inflation pushing in one consistent direction or in conflict?

The detector classifies the current regime into one of several buckets (trending bullish, trending bearish, ranging, regime transition, volatility spike, etc.). The bucket determines how the engine reads the underlying signals.

Confidence weighting

Once the regime is known, the engine applies confidence weighting. Same setup, different regime → different confidence:

  • A bullish technical setup in a CONFIRMED bullish trend → high confidence (e.g. 80%+).
  • The same bullish setup in a regime transition → reduced confidence (50-60%).
  • The same bullish setup in a confirmed bearish trend → low confidence (20-40%). The engine flags this as counter-trend.

Confidence isn't arbitrary. It's calibrated against the engine's backtest accuracy on each regime type. If the model historically got 70% of bullish signals right in trending bullish regimes but only 45% right in transition regimes, those numbers become the confidence floor and ceiling.

Statistical confidence vs subjective confidence

The "confidence" you see isn't a vibe. It's statistical confidence — derived from how often this kind of setup, in this kind of regime, has been correct historically. A 70% confidence score means: out of 100 similar setups in similar regimes, ~70 ended up profitable in the targeted holding window.

That's qualitatively different from "I feel pretty confident about this trade". The number has a backtest behind it.

Risk normalization

The engine also performs risk normalization: scaling its risk-reward calculations to the current volatility regime. A 1× ATR stop in a calm regime is psychologically wider than the same 1× ATR stop in a volatile regime. The dollar amount is different, but the statistical "room" is the same. That keeps the engine's trade quality consistent across calm and turbulent markets.

A direction without a confidence is a guess. A confidence without honest backtesting is marketing. The engine gives you both — direction and the statistical confidence the historical record supports.

How to use confidence as a trader

Three practical rules:

  1. Above 70% confidence — full position size, follow the call.
  2. 50-70% confidence — half size, or wait for one more confirming candle.
  3. Below 50% confidence — the engine is telling you it isn't sure. Skip the trade entirely; "no trade" is a valid decision.

Most retail losses come from trading low-confidence setups at full size. The engine's confidence number is your built-in position-sizing guide.