EMA Crossover Entry Model with RSI Telemetry and JSON Alert Output
IRON-SIGHT-V1 is a baseline trend-following strategy built on a classic dual-EMA crossover. It enters long when the fast 9-period EMA crosses above the slow 21-period EMA, signaling a momentum shift to the upside.
RSI(14) is captured at entry and included in the alert payload as metadata — it is not used as a filter in V1, making this a pure crossover model. The strategy outputs a structured JSON alert message compatible with webhook-based automation pipelines (e.g., NIGHTHAWK).
model_id, rsi, ema_gap) that downstream systems consume.
V2 extends this architecture with ICT/Smart Money logic.
| Condition | Logic | Notes |
|---|---|---|
| Long Entry | ta.crossover(EMA9, EMA21) |
Fires on the bar where the fast EMA crosses above the slow EMA |
| Short Entry | Not defined | V1 is long-only; no short conditions exist |
| Exit Logic | Not explicitly defined | TradingView default: reversal on opposite crossover or end of backtest |
strategy.exit() or strategy.close() calls.
Positions are closed by TradingView's default behavior (next opposing signal or end of data).
For live trading, manual exits or a downstream system must handle position closure.
When a long entry triggers, the following JSON string is passed as the alert_message parameter of strategy.entry() and delivered as the POST body to NIGHTHAWK:
| Field | Type | Description |
|---|---|---|
secret | string | Auth token. NIGHTHAWK returns 401 Unauthorized if missing or incorrect. |
model_id | string | Must match the model_id row in the SENTINEL models table exactly. |
ticker | string | TradingView full symbol ID including exchange prefix (e.g., syminfo.tickerid). |
action | string | BUY, SELL, or TEST. |
price | float | Close price at the entry bar (close). |
metadata.rsi | float | RSI(14) at the moment of entry — logged for downstream analysis, not used as a filter. |
metadata.ema_gap | float | EMA(9) minus EMA(21). Positive value confirms bullish momentum width at entry. |
metadata.timestamp | int | Unix millisecond timestamp from TradingView's timenow. |
| Element | Color | Purpose |
|---|---|---|
| Fast EMA line | Blue | EMA(9) — short-term momentum |
| Slow EMA line | Red | EMA(21) — medium-term trend |
| Crossover point | TradingView default marker | Long entry marked automatically by strategy engine |
Alt+P), clear existing code, paste iron_sight_v1.pine.
A 5-row table is rendered in the top-right corner of the chart on the final bar
(barstate.islast). It gives a real-time read on strategy conditions without opening the Strategy Tester.
| Row | Condition | Green When |
|---|---|---|
| Fast EMA > Slow EMA | fastEMA > slowEMA | EMA(9) is above EMA(21) — bullish alignment |
| EMA Crossover | longCondition | The crossover fired on the most recent bar |
| RSI > 50 | rsiValue > 50 | Momentum is in bullish territory |
| RSI (live) | Text display | Live RSI(14) value — green if > 50 |
| Signal Bias | Text: LONG / WATCH / WAIT | LONG (crossover active), WATCH (EMA aligned, no cross), WAIT (bearish) |
A checkbox input (FORCE MANUAL TRIGGER) appears in the strategy settings. When toggled ON,
the script fires a TEST webhook on the current bar's close using alert(test_msg, alert.freq_all).
strategy.entry(alert_message=...)): Create alert with condition set to Order fills.alert()): Create a separate alert with condition set to Any alert() function call.
Toggle FORCE MANUAL TRIGGER ON, wait for the next bar close, and verify NIGHTHAWK returns
{"status":"Logged"}. Toggle it back OFF immediately after testing.
| Feature | V1 Status | V2 Status |
|---|---|---|
| Entry logic | EMA(9/21) crossover | 8AM range + liquidity sweep + IFVG |
| Short entries | Not implemented | Implemented (VANGUARD_SHORT) |
| Explicit exits | Not defined | TP/SL via strategy.exit() (SENTINEL) |
| RSI filter | Metadata only (no filter) | Not used in V2 either |
| HTF data | None | Previous day H/L + 1H highs/lows |
| Session timing | None (trades all hours) | 8AM–12PM NY time only |
| Alert JSON | secret, model_id, ticker, action, price, metadata.rsi, metadata.ema_gap | secret, model_id, ticker, action, price, metadata.tier, metadata.liquidity, metadata.note |