Structural Reversal Model — S/R Level Detection · Doji Indecision · Directional Reaction
The Level Reaction & Doji Strategy is designed to catch high-conviction market turns at structural supply and demand zones. It automates the "wait for a level, wait for a candle" workflow used by professional price action traders.
The script detects Swing Highs/Lows to establish horizontal levels, monitors for Doji candles at those levels to identify exhausted momentum, and enters only when a Reaction (follow-through) candle confirms the reversal.
Uses a configurable Swing Lookback (default: 20 bars). A Resistance level is formed when a high is higher than the 20 bars before and after it. Support is formed when a low is lower than the 20 bars surrounding it.
A candle is flagged as a Doji if its body size is 10% or less of its total range. This represents a perfect balance between buyers and sellers, often preceding a trend change.
| Step | Condition | Visual Indicator |
|---|---|---|
| Level | Price is within 0.2% of a detected S/R line | Dashboard: "YES" |
| Doji | Current candle body is ≤ 10% of range | Yellow Background / Dashboard: "✓" |
| Reaction | Next candle closes strongly in the reversal direction | BUY / SELL Label |
The strategy includes built-in execution logic compatible with the Vanguard engine:
When an entry condition fires, strategy.entry(alert_message=msg) delivers the following JSON as the POST body to NIGHTHAWK. All fields are required — NIGHTHAWK returns 401 if secret is missing and 500 if model_id is not registered in the SENTINEL models table.
| Field | Description |
|---|---|
secret | Auth token — NIGHTHAWK returns 401 if missing or incorrect |
model_id | Must match SENTINEL models table record exactly — currently REACTION-DOJI-V1 |
ticker | TradingView full symbol ID from syminfo.tickerid |
action | BUY, SELL, or TEST |
price | Close price at the reaction candle bar |
metadata.type | Support_Doji_Reversal (long) or Resistance_Doji_Reversal (short) |
metadata.level | The S/R level price that was respected — logged for signal analysis |
metadata.timestamp | Unix millisecond timestamp from TradingView's timenow |
strategy.entry(alert_message=...)): TradingView alert condition = Order fillsalert() from FORCE MANUAL TRIGGER): alert condition = Any alert() function callThe strategy includes a confluence scoring table in the top-right of the chart. Each of the three conditions scores one point independently — allowing you to see how close a setup is to firing even when not all conditions are met simultaneously.
| Row | Variable | Green When |
|---|---|---|
| Structural Level (p1) | at_support or at_resistance or at_support[1] or at_resistance[1] | Price is or was within 0.2% of a key S/R level on current or prior bar |
| Doji Signature (p2) | is_doji or is_doji[1] | Current or prior bar qualified as a Doji (body ≤ doji_pct% of range) |
| Reaction Breakout (p3) | bull_reaction or bear_reaction | Current bar closed beyond the Doji's range in the reversal direction |
| Tactical Score | Sum of p1 + p2 + p3 | Shows EXECUTE (green) at 3/3, WAIT (gray) below 3 |
| Current Bias | long_condition / short_condition | BULLISH (long), BEARISH (short), NEUTRAL (no signal) |