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!
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Per un accesso rapido a un grafico, aggiungi questo script ai tuoi preferiti: per saperne di più clicca qui.
Declinazione di responsabilità
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Per un accesso rapido a un grafico, aggiungi questo script ai tuoi preferiti: per saperne di più clicca qui.