PROTECTED SOURCE SCRIPT

Hassi XAUUSD 15TF BUY/SELL (Anchored, Non-Repainting)

149
What this does
Hassi XAUUSD 15TF BUY/SELL is a non-repainting signal indicator designed for XAUUSD (Gold) on the 15-minute timeframe (also works on BTCUSD). It blends EMA crossover + RSI + MACD with optional volume & volatility filters, and prints anchored BUY/SELL arrows that stay glued to their candle (no visual drifting on zoom/scale/replay). Optional confidence% labels help you judge signal quality at a glance.

Why it’s stable (no repaint)

Signals confirm only on bar close (barstate.isconfirmed).

Arrows/X marks are placed with label.new(x=bar_index, y=high/low, xloc.bar_index, yloc.abovebar/belowbar) so they remain exactly above/below the triggering candle.

No request.security for higher-TF lookaheads; no negative offsets.

How signals are generated

Core trigger: EMA(9) crosses EMA(21)

RSI filter (opt): RSI ≥ RSI Buy Min (default 50) for buys; ≤ RSI Sell Max (default 50) for sells

MACD filter (opt): MACD line crosses its signal or histogram sign matches direction

Volume/ATR filters (opt): require a basic volume spike and above-average ATR volatility (toggleable)

Divergence (opt): lightweight RSI divergence hints (diamond marks)

Anchored markers

BUY: triangle below the signal candle

SELL: triangle above the signal candle

EXIT (❌): small x above (long exit) / below (short exit) when the opposite signal confirms

Nudges: fine-tune vertical placement with tick offsets (inputs) without breaking anchoring

Inputs (defaults)

Fast EMA: 9

Slow EMA: 21

RSI Length: 14

MACD Fast/Slow/Signal: 12 / 26 / 9

Require RSI filter (50 line): ✅

Require MACD cross filter: ✅

RSI Buy Min / RSI Sell Max: 50 / 50

Buy/Sell/Exit Offset (ticks): 0 / 0 / 0

Advanced toggles: Trend Strength ✅, Dynamic Sizing (visual) ✅, Volume Filter ⛔, Volatility Filter ⛔, RSI Divergence ⛔, Show Confidence ✅

Status line/table: ✅

Alerts

Add any of these in Add Alert → Condition: this indicator

Buy Signal → {{ticker}} BUY @ {{close}} - ANCHORED SIGNAL

Sell Signal → {{ticker}} SELL @ {{close}} - ANCHORED SIGNAL

Exit Mark → {{ticker}} EXIT @ {{close}} - ANCHORED EXIT

Recommended use (15-minute XAUUSD)

Use during active sessions (London/NY overlaps).

Keep defaults; enable Volume & Volatility filters in high-noise conditions.

Add confluence (S/R, structure/BOS, session highs/lows, FVG or HTF bias).

Manage risk with structure-based SL or ATR x 1.0–1.5, and partial TP at 1:1–1.5R.

Note: You mentioned it has ~80% win rate on 15TF in your testing. Performance varies by broker feed, session, spread, and risk management. Treat results as educational, not a guarantee.

Non-repainting notes

Signals lock on close; historical arrows are final.

Labels are bar/price anchored (no drift when you zoom or change scale).

Arrays trim old labels automatically to avoid drawing limits.

FAQ

Q: Why don’t past arrows move when I resize the chart?
A: They’re label.new() anchored to bar_index and bar high/low with xloc/yloc, so they stay with the candle.

Q: Can I turn it into a strategy/backtest?
A: Yes—wrap the same signals into strategy.entry/exit, but this release is an indicator by design.

Q: Will it work on BTC or other pairs/timeframes?
A: Yes, but it’s tuned for XAUUSD M15. Adapt filters for other markets.

Changelog

v1.0 — Initial public release: anchored non-repainting arrows, optional RSI/MACD filters, volume/ATR filter, divergence hints, confidence labels, status panel, alerts.

Disclaimer

This tool is for education and analysis only. It is not financial advice. Trading involves risk; do your own research and manage risk responsibly.

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.