OPEN-SOURCE SCRIPT

Strategy Chameleon [theUltimator5]

4 782
Have you ever looked at an indicator and wondered to yourself "Is this indicator actually profitable?" Well now you can test it out for yourself with the Strategy Chameleon!

Strategy Chameleon is a versatile, signal-agnostic trading strategy designed to adapt to any external indicator or trading system. Like a chameleon changes colors to match its environment, this strategy adapts to match any buy/sell signals you provide, making it the ultimate backtesting and automation tool for traders who want to test multiple strategies without rewriting code.


🎯 Key Features

1) Connects ANY external indicator's buy/sell signals
  • Works with RSI, MACD, moving averages, custom indicators, or any Pine Script output
  • Simply connect your indicator's signal output to the strategy inputs


2) Multiple Stop Loss Types:
  • Percentage-based stops
  • ATR (Average True Range) dynamic stops
  • Fixed point stops


3) Advanced Trailing Stop System:
  • Percentage trailing
  • ATR-based trailing
  • Fixed point trailing



4) Flexible Take Profit Options:
  • Risk:Reward ratio targeting
  • Percentage-based profits
  • ATR-based profits
  • Fixed point profits


5) Trading Direction Control
  • Long Only - Bull market strategies
  • Short Only - Bear market strategies
  • Both - Full market strategies


6) Time-Based Filtering
  • Optional trading session restrictions
  • Customize active trading hours
  • Perfect for day trading strategies



📈 How It Works
  • Signal Detection: The strategy monitors your connected buy/sell signals
  • Entry Logic: Executes trades when signals trigger during valid time periods
  • Risk Management: Automatically applies your chosen stop loss and take profit levels
  • Trailing System: Dynamically adjusts stops to lock in profits
  • Performance Tracking: Real-time statistics table showing win rate and performance



⚙️ Setup Instructions

0) Add indicator you want to test, then add the Strategy to your chart

Connect Your Signals:
https://imgur.com/a/UX6fiIz
Go to strategy settings → Signal Sources
1) Set "Buy Signal Source" to your indicator's buy output
2) Set "Sell Signal Source" to your indicator's sell output
3) Choose table position - This simply changes the table location on the screen
4) Set trading direction preference - Buy only? Sell only? Both directions?
https://imgur.com/a/k8fXEbe
5) Set your preferred stop loss type and level
You can set the stop loss to be either percentage based or ATR and fully configurable.
6) Enable trailing stops if desired
https://imgur.com/a/ycnfxcw
7) Configure take profit settings
8) Toggle time filter to only consider specific time windows or trading sessions.


🚀 Use Cases
  • Test various indicators to determine feasibility and/or profitability.
  • Compare different signal sources quickly
  • Validate trading ideas with consistent risk management


Portfolio Management
  • Apply uniform risk management across different strategies
  • Standardize stop loss and take profit rules
  • Monitor performance consistently


Automation Ready

  • Built-in alert conditions for automated trading
  • Compatible with trading bots and webhooks
  • Easy integration with external systems


⚠️ Important Notes
This strategy requires external signals to function
Default settings use 10% of equity per trade
Pyramiding is disabled (one position at a time)
Strategy calculates on bar close, not every tick


🔗 Integration Examples
Works perfectly with:

RSI strategies (connect RSI > 70 for sells, RSI < 30 for buys)
Moving average crossovers
MACD signal line crosses
Bollinger Band strategies
Custom oscillators and indicators
Multi-timeframe strategies

📋 Default Settings

Position Size: 10% of equity
Stop Loss: 2% percentage-based
Trailing Stop: 1.5% percentage-based (enabled)
Take Profit: Disabled (optional)
Trade Direction: Both long and short
Time Filter: Disabled

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.