Skip to main content
Skip to main content
Version: Next 🚧

Trend Indicators

Trend indicators help identify the direction and strength of market trends, enabling traders to follow momentum and avoid counter-trend trades.

Moving Average Convergence Divergence (MACD)

Calculation

MACD shows the relationship between two moving averages of price, revealing changes in trend strength, direction, and momentum.

Formula:

MACD Line = EMA(12) - EMA(26)
Signal Line = EMA(9) of MACD Line
Histogram = MACD Line - Signal Line

Standard Settings: 12, 26, 9

Step-by-Step Example:

Day 1-26: Calculate EMA(12) and EMA(26)
EMA(12) = 105.50
EMA(26) = 104.20

MACD Line = 105.50 - 104.20 = 1.30

Day 27-35: Calculate Signal Line
Signal Line = EMA(9) of MACD values
Signal Line = 1.15

Histogram = 1.30 - 1.15 = 0.15

Components

ComponentCalculationPurpose
MACD LineFast EMA - Slow EMAShows momentum direction
Signal Line9 EMA of MACDTriggers buy/sell signals
HistogramMACD - SignalShows momentum strength

Characteristics

  • Range: Unbounded (oscillates around zero)
  • Bullish: MACD > 0 and rising
  • Bearish: MACD < 0 and falling
  • Standard Settings: 12, 26, 9
  • Fast Settings: 8, 17, 9 (for shorter timeframes)

Interpretation

SignalConditionMeaning
Bullish CrossoverMACD crosses above SignalBuy signal
Bearish CrossoverMACD crosses below SignalSell signal
Zero Line CrossMACD crosses above/below 0Trend change
Histogram ExpansionHistogram growingMomentum increasing
Histogram ContractionHistogram shrinkingMomentum decreasing

Usage Examples

MACD Bullish Crossover:

{
"indicator1": "macd",
"period1": "12,26,9",
"indicator2": "macd_signal",
"period2": "12,26,9",
"comparison": "crosses_above"
}
// MACD line crosses above signal line = buy

MACD Zero Line Cross:

{
"type": "indicator_value",
"indicator": "macd",
"period": "12,26,9",
"comparison": "crosses_above",
"value": 0
}
// MACD crosses above zero = bullish trend

Histogram Turns Positive:

{
"type": "indicator_value",
"indicator": "macd_histogram",
"period": "12,26,9",
"comparison": "crosses_above",
"value": 0
}
// Histogram crosses above zero = momentum shift

MACD Strategies

1. Classic MACD Crossover:

{
"entryConditions": {
"long": {
"conditions": [
{
"indicator1": "macd",
"period1": "12,26,9",
"indicator2": "macd_signal",
"period2": "12,26,9",
"comparison": "crosses_above"
}
]
},
"short": {
"conditions": [
{
"indicator1": "macd",
"period1": "12,26,9",
"indicator2": "macd_signal",
"period2": "12,26,9",
"comparison": "crosses_below"
}
]
}
}
}

2. MACD with Trend Filter:

{
"entryConditions": {
"long": {
"logicalOperator": "AND",
"conditions": [
{
"type": "price_indicator",
"price": "close",
"indicator": "ema",
"period": 200,
"comparison": "above"
},
{
"indicator1": "macd",
"period1": "12,26,9",
"indicator2": "macd_signal",
"period2": "12,26,9",
"comparison": "crosses_above"
}
]
}
}
}
// Only take MACD signals in uptrend (above 200 EMA)

3. MACD Histogram Reversal:

{
"entryConditions": {
"long": {
"logicalOperator": "AND",
"conditions": [
{
"type": "indicator_value",
"indicator": "macd_histogram",
"period": "12,26,9",
"comparison": "below",
"value": 0
},
{
"type": "indicator_value",
"indicator": "macd_histogram",
"period": "12,26,9",
"comparison": "crosses_above",
"value": 0
}
]
}
}
}
// Enter when histogram crosses from negative to positive

MACD Divergence

Bullish Divergence:

  • Price makes lower low
  • MACD makes higher low
  • Signal: Potential reversal to upside

Bearish Divergence:

  • Price makes higher high
  • MACD makes lower high
  • Signal: Potential reversal to downside

Average Directional Index (ADX)

Calculation

ADX measures trend strength regardless of direction, helping traders determine if a market is trending or ranging.

Formula:

Step 1: Calculate True Range (TR)
TR = max[(High - Low), |High - Close_prev|, |Low - Close_prev|]

Step 2: Calculate Directional Movement
+DM = High - High_prev (if positive, else 0)
-DM = Low_prev - Low (if positive, else 0)

Step 3: Smooth and Calculate Directional Indicators
+DI = (Smoothed +DM / ATR) × 100
-DI = (Smoothed -DM / ATR) × 100

Step 4: Calculate DX
DX = (|+DI - -DI| / (+DI + -DI)) × 100

Step 5: Calculate ADX
ADX = Smoothed average of DX (typically 14 periods)

Characteristics

  • Range: 0 to 100
  • Weak Trend: ADX < 20
  • Developing Trend: ADX 20-25
  • Strong Trend: ADX 25-50
  • Very Strong Trend: ADX > 50
  • Extreme: ADX > 75 (rare)
  • Period: 14 (standard)

Interpretation

ADX ValueTrend StrengthTrading Strategy
0-20No trend / RangingAvoid trend-following, use range strategies
20-25Weak trendCaution, wait for confirmation
25-50Strong trendTrend-following strategies work well
50-75Very strong trendRide the trend, avoid counter-trend
75-100Extremely strongTrend exhaustion possible

Directional Indicators

ConditionSignal
+DI > -DIUptrend
-DI > +DIDowntrend
+DI crosses above -DIBullish signal
-DI crosses above +DIBearish signal

Usage Examples

Strong Trend Filter:

{
"type": "indicator_value",
"indicator": "adx",
"period": 14,
"comparison": "above",
"value": 25
}
// ADX > 25 = strong trend, safe for trend-following

Uptrend Confirmation:

{
"logicalOperator": "AND",
"conditions": [
{
"type": "indicator_value",
"indicator": "adx",
"period": 14,
"comparison": "above",
"value": 25
},
{
"indicator1": "plus_di",
"period1": 14,
"indicator2": "minus_di",
"period2": 14,
"comparison": "above"
}
]
}
// ADX > 25 AND +DI > -DI = strong uptrend

DI Crossover:

{
"indicator1": "plus_di",
"period1": 14,
"indicator2": "minus_di",
"period2": 14,
"comparison": "crosses_above"
}
// +DI crosses above -DI = bullish signal

ADX Strategies

1. ADX Trend Filter:

{
"entryConditions": {
"long": {
"logicalOperator": "AND",
"conditions": [
{
"type": "indicator_value",
"indicator": "adx",
"period": 14,
"comparison": "above",
"value": 25
},
{
"indicator1": "ema",
"period1": 20,
"indicator2": "ema",
"period2": 50,
"comparison": "crosses_above"
}
]
}
}
}
// Only take EMA crossover when ADX confirms strong trend

2. ADX with Directional Indicators:

{
"entryConditions": {
"long": {
"logicalOperator": "AND",
"conditions": [
{
"type": "indicator_value",
"indicator": "adx",
"period": 14,
"comparison": "above",
"value": 20
},
{
"indicator1": "plus_di",
"period1": 14,
"indicator2": "minus_di",
"period2": 14,
"comparison": "crosses_above"
}
]
}
}
}
// Enter when +DI crosses above -DI with ADX > 20

Parabolic SAR (Stop and Reverse)

Calculation

Parabolic SAR provides potential entry and exit points by placing dots above or below price, indicating trend direction.

Formula:

SAR_tomorrow = SAR_today + AF × (EP - SAR_today)

Where:
- AF = Acceleration Factor (starts at 0.02, increases by 0.02 each period, max 0.20)
- EP = Extreme Point (highest high in uptrend, lowest low in downtrend)
- SAR = Stop and Reverse point

Example:

Uptrend:
Day 1: SAR = 100, EP = 105, AF = 0.02
Day 2: SAR = 100 + 0.02 × (105 - 100) = 100.10

If new high is made:
Day 3: EP = 106, AF = 0.04
Day 3: SAR = 100.10 + 0.04 × (106 - 100.10) = 100.34

If price closes below SAR:
Trend reverses, SAR switches to above price

Characteristics

  • Position: Dots below price (uptrend), above price (downtrend)
  • Acceleration Factor: 0.02 to 0.20 (standard)
  • Best For: Trending markets
  • Weakness: Whipsaws in ranging markets
  • Use: Trailing stops, trend identification

Interpretation

ConditionSignal
SAR below priceUptrend, hold long
SAR above priceDowntrend, hold short
Price crosses below SARExit long, enter short
Price crosses above SARExit short, enter long

Usage Examples

Uptrend Confirmation:

{
"type": "price_indicator",
"price": "close",
"indicator": "parabolic_sar",
"comparison": "above"
}
// Price above SAR = uptrend

Trend Reversal (Bullish):

{
"type": "price_indicator",
"price": "close",
"indicator": "parabolic_sar",
"comparison": "crosses_above"
}
// Price crosses above SAR = bullish reversal

Trailing Stop:

{
"exitConditions": {
"stopLoss": {
"type": "indicator",
"indicator": "parabolic_sar"
}
}
}
// Use SAR as trailing stop loss

Parabolic SAR Strategies

1. SAR Reversal System:

{
"entryConditions": {
"long": {
"conditions": [
{
"type": "price_indicator",
"price": "close",
"indicator": "parabolic_sar",
"comparison": "crosses_above"
}
]
},
"short": {
"conditions": [
{
"type": "price_indicator",
"price": "close",
"indicator": "parabolic_sar",
"comparison": "crosses_below"
}
]
}
},
"exitConditions": {
"oppositeSignal": {
"enabled": true,
"closeImmediately": true
}
}
}
// Enter on SAR flip, exit on opposite signal

2. SAR with Trend Filter:

{
"entryConditions": {
"long": {
"logicalOperator": "AND",
"conditions": [
{
"type": "price_indicator",
"price": "close",
"indicator": "ema",
"period": 200,
"comparison": "above"
},
{
"type": "price_indicator",
"price": "close",
"indicator": "parabolic_sar",
"comparison": "crosses_above"
}
]
}
}
}
// Only take SAR signals in direction of 200 EMA

Comparison: MACD vs ADX vs Parabolic SAR

FeatureMACDADXParabolic SAR
PurposeMomentum & trend changesTrend strengthTrend direction & stops
RangeUnbounded0-100Price-based
SignalsCrossovers, divergencesStrength levelsPrice crosses
Best ForEntry timingTrend confirmationTrailing stops
LagMediumHighLow
Ranging MarketsPoorExcellent (identifies)Poor
Trending MarketsGoodExcellentExcellent

Trend Indicator Combinations

1. MACD + ADX (Momentum with Strength)

Setup:

  • MACD(12,26,9) for entry signals
  • ADX(14) for trend strength filter

Entry (Long):

  • ADX > 25 (strong trend)
  • MACD crosses above signal line
{
"entryConditions": {
"long": {
"logicalOperator": "AND",
"conditions": [
{
"type": "indicator_value",
"indicator": "adx",
"period": 14,
"comparison": "above",
"value": 25
},
{
"indicator1": "macd",
"period1": "12,26,9",
"indicator2": "macd_signal",
"period2": "12,26,9",
"comparison": "crosses_above"
}
]
}
}
}

2. MACD + Parabolic SAR (Momentum with Stops)

Setup:

  • MACD(12,26,9) for entries
  • Parabolic SAR for trailing stops

Entry (Long):

  • MACD crosses above signal
  • Price above SAR

Exit:

  • Price crosses below SAR
{
"entryConditions": {
"long": {
"logicalOperator": "AND",
"conditions": [
{
"indicator1": "macd",
"period1": "12,26,9",
"indicator2": "macd_signal",
"period2": "12,26,9",
"comparison": "crosses_above"
},
{
"type": "price_indicator",
"price": "close",
"indicator": "parabolic_sar",
"comparison": "above"
}
]
}
},
"exitConditions": {
"stopLoss": {
"type": "indicator",
"indicator": "parabolic_sar"
}
}
}

3. Triple Trend Confirmation

Setup:

  • MACD for momentum
  • ADX for strength
  • +DI/-DI for direction

Entry (Long):

  • MACD > 0
  • ADX > 25
  • +DI > -DI
{
"entryConditions": {
"long": {
"logicalOperator": "AND",
"conditions": [
{
"type": "indicator_value",
"indicator": "macd",
"period": "12,26,9",
"comparison": "above",
"value": 0
},
{
"type": "indicator_value",
"indicator": "adx",
"period": 14,
"comparison": "above",
"value": 25
},
{
"indicator1": "plus_di",
"period1": 14,
"indicator2": "minus_di",
"period2": 14,
"comparison": "above"
}
]
}
}
}

Best Practices

Do's

  • ✅ Use MACD for entry timing in trending markets
  • ✅ Use ADX to filter out ranging markets (ADX < 20)
  • ✅ Use Parabolic SAR for trailing stops
  • ✅ Combine trend indicators with momentum indicators
  • ✅ Wait for candle close before acting on signals
  • ✅ Use longer periods for higher timeframes

Don'ts

  • ❌ Use MACD or SAR in ranging markets (many false signals)
  • ❌ Ignore ADX when trend-following (leads to whipsaws)
  • ❌ Use Parabolic SAR alone without confirmation
  • ❌ Trade against strong trends (ADX > 50)
  • ❌ Over-optimize indicator parameters
  • ❌ Use all three indicators together (redundant)

Common Pitfalls

1. MACD Whipsaws in Ranging Markets

Problem: Multiple false crossovers Solution: Use ADX filter (only trade when ADX > 25)

2. ADX Lag

Problem: ADX confirms trend after it's already started Solution: Use ADX as filter, not entry signal

3. Parabolic SAR Flips Too Often

Problem: Frequent reversals in choppy markets Solution: Combine with trend filter (EMA or ADX)