Anomaly Counter-Trend Strategy

🔎 Overview
ACTS monitors the percent-change over the past N minutes and, when that move exceeds your chosen threshold, enters a counter-trend position (short on a strong rise; long on a sharp fall). It’s ideal for markets that often “overshoot” and snap back, and can be applied on any symbol or timeframe.
⚙️ Key Features
Anomaly Detection: Detect abnormal price swings based on a user-defined % change over a lookback period.
Counter-Trend Entries: Auto-enter short on rise anomalies, long on fall anomalies (with seamless flat↔reverse transitions).
Risk Management: Configurable stop-loss and take-profit in ticks per trade.
Realistic Modeling: Simulates commissions (0.05 % default), slippage (2 ticks), and percent-of-equity sizing.
Immediate Bar-Close Execution: Orders processed on bar close for faster fills.
Visual Aids: Optional on-chart BUY/SELL triangles and background highlights during anomaly periods.
⚙️ Inputs
Input Default Description
Percentage Threshold (%) 2.00 Min % move over lookback to trigger an anomaly.
Lookback Period (Minutes) 15 Number of minutes over which to measure change.
Stop Loss (Ticks) 100 Distance from entry for stop-loss exit.
Take Profit (Ticks) 200 Distance from entry for take-profit exit.
Plot Trade Signal Shapes (on/off) true Show BUY/SELL triangles on chart.
Highlight Anomaly Background true Shade background during anomaly bars.
📊 How to Use
Add to Chart: Apply the script to any ticker & timeframe.
Tune: Adjust your percentage threshold and lookback to match each instrument’s volatility.
Review Backtest: Check built-in strategy performance (drawdown, Sharpe, etc.) under the Strategy Tester tab.
Go Live: Once optimized, link to alerts or your trade execution system.
⚠️ Disclaimer
This script is provided “as-is” for educational purposes and backtesting only. Past performance does not guarantee future results. Always backtest thoroughly, manage your own risk, and consider market conditions before live trading.
Enjoy experimenting—and may your counter-trend entries catch the next big snapback!
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Untuk akses pantas pada carta, tambah skrip ini kepada kegemaran anda — ketahui lebih lanjut di sini.
Penafian
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Untuk akses pantas pada carta, tambah skrip ini kepada kegemaran anda — ketahui lebih lanjut di sini.