Aroon Buy & Sell (Custom TFs)

🧠 Strategy Overview:
This script generates buy and sell signals using the Aroon indicator across two different timeframes:
* One for detecting the primary trend (Trend Timeframe)
* One for confirming precise entry signals (Signal Confirmation Timeframe)
📊 Key Components:
1. User Inputs
* trendTF: The timeframe used to determine overall trend direction (e.g., 5-minute).
* signalTF: The faster timeframe for confirming trade signals (e.g., 1-minute).
* aroonLength: Lookback period for the Aroon calculation (default 14).
* cooldownPeriod: Number of bars to wait before allowing a new signal.
2. Aroon Calculation Function
Calculates Aroon Up and Aroon Down values using the number of bars since the highest high and lowest low.
3. Multi-Timeframe Aroon Values
Uses request.security to compute Aroon values on both trendTF and signalTF.
4. Trend Detection
* A bullish trend is defined when Aroon Up crosses above Aroon Down on the trend timeframe.
* A bearish trend is defined when Aroon Down crosses above Aroon Up.
5. Signal Logic
* Buy Signal: When the overall trend is bullish and Aroon Down = 100 on the signal timeframe.
* Sell Signal: When the trend is bearish and Aroon Up = 100 on the signal timeframe.
6. Cooldown Mechanism
Prevents back-to-back signals by enforcing a cooldown (e.g., 20 bars) after each buy/sell.
7. Signal Plotting & Alerts
Plots buy/sell signals directly on the chart and supports alerts for automation.
📈 Visual Output:
* BUY label below the bar when buy conditions are met.
* SELL label above the bar when sell conditions are met.
🔔 Alerts:
Two alertconditions are defined to trigger alerts whenever a buy or sell signal occurs.
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.