OPEN-SOURCE SCRIPT
Mustang Algo - Momentum Trend Zone Backtest

🐎 MUSTANG ALGO - Momentum Trend Zone Strategy
A complete trading system combining MACD momentum analysis with visual trend zones, full backtesting capabilities, and advanced risk management tools.
══════════════════════════════════════════════════════════════════════════
🔹 OVERVIEW
Mustang Algo transforms traditional MACD analysis into a powerful visual trading system. It instantly identifies market bias through colored background zones and provides clear entry/exit signals with customizable stop loss and take profit management.
══════════════════════════════════════════════════════════════════════════
🔹 KEY FEATURES
✅ Visual Trend Zones (Green = Bullish | Red = Bearish)
✅ Clear Buy/Sell Triangles on Chart
✅ Full Backtesting Engine
✅ Multiple Stop Loss Types
✅ Multiple Take Profit Types
✅ Trailing Stop Option
✅ Time Filter for Backtesting
✅ Real-time Info Panel
✅ Customizable Alerts
══════════════════════════════════════════════════════════════════════════
🔹 HOW IT WORKS
The strategy uses a smoothed MACD system to detect trend changes:
- MACD Line (White): Fast EMA minus Slow EMA - shows raw momentum
- Signal Line (Yellow): EMA of MACD - shows smoothed trend direction
- Trend Zone: Changes when the smoothed signal line crosses zero
- Entry Signals: Generated at zone transitions
When the trend line crosses above zero → GREEN zone → BUY signal 🔺
When the trend line crosses below zero → RED zone → SELL signal 🔻
══════════════════════════════════════════════════════════════════════════
🔹 STOP LOSS OPTIONS
🛑 Percentage: Fixed percentage from entry price
🛑 ATR-Based: Dynamic SL based on market volatility
🛑 Fixed Points: Set number of points/pips
🛑 Swing Low/High: Uses recent swing levels as stops
══════════════════════════════════════════════════════════════════════════
🔹 TAKE PROFIT OPTIONS
🎯 Percentage: Fixed percentage target
🎯 ATR-Based: Dynamic TP based on volatility
🎯 Fixed Points: Set number of points/pips
🎯 Risk Reward: Automatic TP based on R:R ratio (e.g., 2:1, 3:1)
══════════════════════════════════════════════════════════════════════════
🔹 TRAILING STOP
📈 Percentage-Based: Trail by a fixed percentage
📈 ATR-Based: Trail using ATR multiplier for dynamic adjustment
══════════════════════════════════════════════════════════════════════════
🔹 SETTINGS
MACD Parameters:
- Fast Length (default: 12)
- Slow Length (default: 26)
- Signal Length (default: 9)
- Trend Smoothing (default: 5)
Risk Management:
- Enable/Disable Stop Loss
- Enable/Disable Take Profit
- Enable/Disable Trailing Stop
- Customize all SL/TP parameters
Visual Options:
- Show/Hide Buy/Sell Triangles
- Show/Hide SL/TP Lines
- Show/Hide Labels
Time Filter:
- Set Start Date for backtest
- Set End Date for backtest
══════════════════════════════════════════════════════════════════════════
🔹 SIGNALS EXPLAINED
🟢 GREEN TRIANGLE (Below Bar):
Bullish zone detected - Consider LONG entry
🔴 RED TRIANGLE (Above Bar):
Bearish zone detected - Consider SHORT entry
🟢 GREEN BACKGROUND:
Currently in bullish trend zone
🔴 RED BACKGROUND:
Currently in bearish trend zone
══════════════════════════════════════════════════════════════════════════
🔹 INFO PANEL
The real-time info panel (top right) displays:
- Current Trend Zone status
- MACD value
- Signal Line value
- Active SL Type
- Active TP Type
══════════════════════════════════════════════════════════════════════════
🔹 ALERTS
Set up alerts for:
🔔 Buy Signals: "🐎 Mustang Algo: BUY Signal on {ticker} at {price}"
🔔 Sell Signals: "🐎 Mustang Algo: SELL Signal on {ticker} at {price}"
══════════════════════════════════════════════════════════════════════════
🔹 BEST PRACTICES
1. Use higher timeframes (1H, 4H, Daily) for more reliable signals
2. Combine with price action and support/resistance levels
3. Adjust ATR multipliers based on asset volatility
4. Use Risk Reward ratio for consistent risk management
5. Backtest on your preferred asset before live trading
══════════════════════════════════════════════════════════════════════════
🔹 RECOMMENDED TIMEFRAMES
⏱️ Scalping: 5M, 15M (more signals, more noise)
⏱️ Day Trading: 1H, 4H (balanced signals)
⏱️ Swing Trading: Daily, Weekly (fewer but stronger signals)
══════════════════════════════════════════════════════════════════════════
🔹 MARKETS
Works on all markets:
📈 Forex
📈 Crypto
📈 Stocks
📈 Indices
📈 Commodities
📈 Futures
══════════════════════════════════════════════════════════════════════════
🐎 RIDE THE TREND WITH MUSTANG ALGO!
══════════════════════════════════════════════════════════════════════════
⚠️ DISCLAIMER
This indicator/strategy is for educational and informational purposes only. It is not financial advice. Trading involves substantial risk of loss and is not suitable for all investors. Past performance is not indicative of future results. Always use proper risk management, do your own research, and consider consulting a financial advisor before making any trading decisions. Use at your own risk.
══════════════════════════════════════════════════════════════════════════
📝 VERSION HISTORY
v1.0 - Initial Release
- MACD-based trend detection
- Visual trend zones
- Multiple SL/TP options
- Full backtesting support
- Trailing stop functionality
- Time filter
- Info panel
- Alert system
══════════════════════════════════════════════════════════════════════════
💬 FEEDBACK
If you find this strategy useful, please leave a comment or suggestion!
Your feedback helps improve future updates.
🐎 Happy Trading!
A complete trading system combining MACD momentum analysis with visual trend zones, full backtesting capabilities, and advanced risk management tools.
══════════════════════════════════════════════════════════════════════════
🔹 OVERVIEW
Mustang Algo transforms traditional MACD analysis into a powerful visual trading system. It instantly identifies market bias through colored background zones and provides clear entry/exit signals with customizable stop loss and take profit management.
══════════════════════════════════════════════════════════════════════════
🔹 KEY FEATURES
✅ Visual Trend Zones (Green = Bullish | Red = Bearish)
✅ Clear Buy/Sell Triangles on Chart
✅ Full Backtesting Engine
✅ Multiple Stop Loss Types
✅ Multiple Take Profit Types
✅ Trailing Stop Option
✅ Time Filter for Backtesting
✅ Real-time Info Panel
✅ Customizable Alerts
══════════════════════════════════════════════════════════════════════════
🔹 HOW IT WORKS
The strategy uses a smoothed MACD system to detect trend changes:
- MACD Line (White): Fast EMA minus Slow EMA - shows raw momentum
- Signal Line (Yellow): EMA of MACD - shows smoothed trend direction
- Trend Zone: Changes when the smoothed signal line crosses zero
- Entry Signals: Generated at zone transitions
When the trend line crosses above zero → GREEN zone → BUY signal 🔺
When the trend line crosses below zero → RED zone → SELL signal 🔻
══════════════════════════════════════════════════════════════════════════
🔹 STOP LOSS OPTIONS
🛑 Percentage: Fixed percentage from entry price
🛑 ATR-Based: Dynamic SL based on market volatility
🛑 Fixed Points: Set number of points/pips
🛑 Swing Low/High: Uses recent swing levels as stops
══════════════════════════════════════════════════════════════════════════
🔹 TAKE PROFIT OPTIONS
🎯 Percentage: Fixed percentage target
🎯 ATR-Based: Dynamic TP based on volatility
🎯 Fixed Points: Set number of points/pips
🎯 Risk Reward: Automatic TP based on R:R ratio (e.g., 2:1, 3:1)
══════════════════════════════════════════════════════════════════════════
🔹 TRAILING STOP
📈 Percentage-Based: Trail by a fixed percentage
📈 ATR-Based: Trail using ATR multiplier for dynamic adjustment
══════════════════════════════════════════════════════════════════════════
🔹 SETTINGS
MACD Parameters:
- Fast Length (default: 12)
- Slow Length (default: 26)
- Signal Length (default: 9)
- Trend Smoothing (default: 5)
Risk Management:
- Enable/Disable Stop Loss
- Enable/Disable Take Profit
- Enable/Disable Trailing Stop
- Customize all SL/TP parameters
Visual Options:
- Show/Hide Buy/Sell Triangles
- Show/Hide SL/TP Lines
- Show/Hide Labels
Time Filter:
- Set Start Date for backtest
- Set End Date for backtest
══════════════════════════════════════════════════════════════════════════
🔹 SIGNALS EXPLAINED
🟢 GREEN TRIANGLE (Below Bar):
Bullish zone detected - Consider LONG entry
🔴 RED TRIANGLE (Above Bar):
Bearish zone detected - Consider SHORT entry
🟢 GREEN BACKGROUND:
Currently in bullish trend zone
🔴 RED BACKGROUND:
Currently in bearish trend zone
══════════════════════════════════════════════════════════════════════════
🔹 INFO PANEL
The real-time info panel (top right) displays:
- Current Trend Zone status
- MACD value
- Signal Line value
- Active SL Type
- Active TP Type
══════════════════════════════════════════════════════════════════════════
🔹 ALERTS
Set up alerts for:
🔔 Buy Signals: "🐎 Mustang Algo: BUY Signal on {ticker} at {price}"
🔔 Sell Signals: "🐎 Mustang Algo: SELL Signal on {ticker} at {price}"
══════════════════════════════════════════════════════════════════════════
🔹 BEST PRACTICES
1. Use higher timeframes (1H, 4H, Daily) for more reliable signals
2. Combine with price action and support/resistance levels
3. Adjust ATR multipliers based on asset volatility
4. Use Risk Reward ratio for consistent risk management
5. Backtest on your preferred asset before live trading
══════════════════════════════════════════════════════════════════════════
🔹 RECOMMENDED TIMEFRAMES
⏱️ Scalping: 5M, 15M (more signals, more noise)
⏱️ Day Trading: 1H, 4H (balanced signals)
⏱️ Swing Trading: Daily, Weekly (fewer but stronger signals)
══════════════════════════════════════════════════════════════════════════
🔹 MARKETS
Works on all markets:
📈 Forex
📈 Crypto
📈 Stocks
📈 Indices
📈 Commodities
📈 Futures
══════════════════════════════════════════════════════════════════════════
🐎 RIDE THE TREND WITH MUSTANG ALGO!
══════════════════════════════════════════════════════════════════════════
⚠️ DISCLAIMER
This indicator/strategy is for educational and informational purposes only. It is not financial advice. Trading involves substantial risk of loss and is not suitable for all investors. Past performance is not indicative of future results. Always use proper risk management, do your own research, and consider consulting a financial advisor before making any trading decisions. Use at your own risk.
══════════════════════════════════════════════════════════════════════════
📝 VERSION HISTORY
v1.0 - Initial Release
- MACD-based trend detection
- Visual trend zones
- Multiple SL/TP options
- Full backtesting support
- Trailing stop functionality
- Time filter
- Info panel
- Alert system
══════════════════════════════════════════════════════════════════════════
💬 FEEDBACK
If you find this strategy useful, please leave a comment or suggestion!
Your feedback helps improve future updates.
🐎 Happy Trading!
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
この情報および投稿は、TradingViewが提供または推奨する金融、投資、トレード、その他のアドバイスや推奨を意図するものではなく、それらを構成するものでもありません。詳細は利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
この情報および投稿は、TradingViewが提供または推奨する金融、投資、トレード、その他のアドバイスや推奨を意図するものではなく、それらを構成するものでもありません。詳細は利用規約をご覧ください。