Trading Strategy

Aroon Strategy

A trend strength and direction strategy using the Aroon Indicator to identify trend changes and momentum shifts.

Trend Strength & Direction

The Aroon Indicator is a unique technical analysis tool that identifies trend changes and strength by measuring the time since the highest high and lowest low over a lookback period. Aroon Up measures bullish momentum while Aroon Down measures bearish momentum. When Aroon Up crosses above Aroon Down, it signals a potential bullish trend change, and vice versa.

Trend Strength Type
4h Chart Timeframe
Intermediate Complexity
Aroon + EMA + ATR Indicators

Signal Logic

Long (Buy)

Aroon Up crosses above Aroon Down, Aroon Up is above threshold (70+), price is above 200 EMA.

Short (Sell)

Aroon Down crosses above Aroon Up, Aroon Down is above threshold (70+), price is below 200 EMA.

Implementation

//@version=6
strategy("Aroon Strategy", overlay=true, initial_capital=1000000, default_qty_type=strategy.percent_of_equity, default_qty_value=100)

// ==========================================
// 🔹 INPUTS
// ==========================================
// Group: Aroon Settings
grp_aroon = "Aroon Settings"
aroon_len = input.int(25, "Aroon Period", minval=1, group=grp_aroon)
aroon_thresh = input.int(70, "Aroon Threshold", minval=0, maxval=100, group=grp_aroon)

// Group: Trend Filter
grp_trend = "Trend Filter"
use_trend = input.bool(true, "Use Trend Filter (EMA 200)", group=grp_trend)
ema_len   = input.int(200, "Trend EMA Length", minval=1, group=grp_trend)

// Group: Risk Management
grp_risk = "Risk Management"
atr_len  = input.int(14, "ATR Length", minval=1, group=grp_risk)
sl_mult = input.float(2.0, "Stop Loss (ATR Multiplier)", step=0.1, group=grp_risk)
tp_ratio = input.float(2.0, "Risk:Reward Ratio", step=0.1, group=grp_risk)

// ==========================================
// 🔹 CALCULATIONS
// ==========================================
// Aroon Indicator
[aroon_up, aroon_down] = ta.aroon(aroon_len, aroon_len)

// Aroon Oscillator
aroon_oscillator = aroon_up - aroon_down

// Trend EMA
ema_val = ta.ema(close, ema_len)

// ATR for risk management
atr_val = ta.atr(atr_len)

// Trend conditions
trend_up = use_trend ? close > ema_val : true
trend_down = use_trend ? close < ema_val : true

// Strong uptrend: Aroon Up above threshold
strong_uptrend = aroon_up > aroon_thresh

// Strong downtrend: Aroon Down above threshold
strong_downtrend = aroon_down > aroon_thresh

// ==========================================
// 🔹 STRATEGY LOGIC
// ==========================================
// Long Entry: Aroon Up crosses above Aroon Down (bullish trend change)
long_signal = ta.crossover(aroon_up, aroon_down) and strong_uptrend and trend_up

// Short Entry: Aroon Down crosses above Aroon Up (bearish trend change)
short_signal = ta.crossover(aroon_down, aroon_up) and strong_downtrend and trend_down

// ==========================================
// 🔹 EXECUTION & RISK MANAGEMENT
// ==========================================

if long_signal
    strategy.entry("Long", strategy.long, comment="L | Aroon Bull")

if short_signal
    strategy.entry("Short", strategy.short, comment="S | Aroon Bear")

// Risk management with ATR
if strategy.position_size > 0
    stop_level = strategy.position_avg_price - (atr_val * sl_mult)
    profit_level = strategy.position_avg_price + (atr_val * sl_mult * tp_ratio)
    strategy.exit("Exit Long", "Long", stop=stop_level, limit=profit_level, comment_loss="SL", comment_profit="TP")

if strategy.position_size < 0
    stop_level = strategy.position_avg_price + (atr_val * sl_mult)
    profit_level = strategy.position_avg_price - (atr_val * sl_mult * tp_ratio)
    strategy.exit("Exit Short", "Short", stop=stop_level, limit=profit_level, comment_loss="SL", comment_profit="TP")

// ==========================================
// 🔹 VISUALS
// ==========================================
// Plot Aroon values in separate pane (commented out for overlay)
// plot(aroon_up, "Aroon Up", color=color.green, linewidth=2)
// plot(aroon_down, "Aroon Down", color=color.red, linewidth=2)
// plot(aroon_oscillator, "Aroon Oscillator", color=color.blue, linewidth=1)

// Plot Trend EMA
plot(use_trend ? ema_val : na, "Trend EMA", color=color.new(color.orange, 0), linewidth=2)

// Plot Signals on price chart
plotshape(long_signal, title="Long Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY", textcolor=color.white)
plotshape(short_signal, title="Short Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL", textcolor=color.white)

// Background color for strong trends
bgcolor(strong_uptrend ? color.new(color.green, 95) : strong_downtrend ? color.new(color.red, 95) : na)