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.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.