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提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。