OPEN-SOURCE SCRIPT
Trinity Swing Trading Buy and Sell

This is a simple little Heiken Ashi MA + ADX & MACD trend-following trading system designed to capture medium- to longer-term moves while filtering out noise and weak trends. It combines modified Heiken Ashi candles (for smoother trend detection) with a moving average alignment, plus optional confirmation from ADX (trend strength) and MACD (momentum).
In practice, the indicator works well on higher timeframes (e.g., 1H, 4H, daily) where trends are more sustained. It performs best in trending markets and naturally avoids choppy/range-bound conditions thanks to the ADX filter (requiring ADX > 20 by default). All key components are fully customizable, so you can disable filters or adjust parameters to suit different instruments (stocks, forex, crypto, futures).
Default settings are:
16 HMA
8,17,9 MACD
15,20 ADX
Recommend to add an additional longer term EMA like 200 for long term trend confirmation.
Adjust inputs in the settings panel as needed:
Toggle MA, ADX, or MACD filters on/off.
Change MA type/length, MACD parameters, ADX threshold
- Use the visual blue diamonds (below bars) for long entries and purple diamonds (above bars) for short entries as confirmation of signals.
- Set alerts on the "Buy Alert" and "Sell Alert" conditions if you want real-time notifications.
This setup gives you a complete, rule-based system that avoids emotional trading and repetitive entries, making it suitable for both backtesting and live trading with proper risk management.
In practice, the indicator works well on higher timeframes (e.g., 1H, 4H, daily) where trends are more sustained. It performs best in trending markets and naturally avoids choppy/range-bound conditions thanks to the ADX filter (requiring ADX > 20 by default). All key components are fully customizable, so you can disable filters or adjust parameters to suit different instruments (stocks, forex, crypto, futures).
Default settings are:
16 HMA
8,17,9 MACD
15,20 ADX
Recommend to add an additional longer term EMA like 200 for long term trend confirmation.
Adjust inputs in the settings panel as needed:
Toggle MA, ADX, or MACD filters on/off.
Change MA type/length, MACD parameters, ADX threshold
- Use the visual blue diamonds (below bars) for long entries and purple diamonds (above bars) for short entries as confirmation of signals.
- Set alerts on the "Buy Alert" and "Sell Alert" conditions if you want real-time notifications.
This setup gives you a complete, rule-based system that avoids emotional trading and repetitive entries, making it suitable for both backtesting and live trading with proper risk management.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.