T
Traderoid

Trend Direction Node

Trend Direction Detector

IndicatorTrendDirection

Overview

The Trend Direction node is a straightforward indicator that identifies and classifies the current market trend using two moving averages of different periods. It provides a simple, clear output of whether the market is in an uptrend, downtrend, or neutral state, along with a strength measure.

This indicator is particularly useful as a filter or confirmation tool in trading systems. By comparing a fast (short-period) moving average to a slow (long-period) moving average, it quickly identifies trend direction. The strength value quantifies how decisive the trend is, helping traders distinguish between strong, actionable trends and weak, questionable ones.

Formula

Trend Direction uses a simple moving average crossover approach with strength calculation:

1. Calculate Moving Averages
Short MA = SMA(close, shortPeriod)
Long MA = SMA(close, longPeriod)
Two simple moving averages of different lengths
2. Determine Direction
If Short MA > Long MA: direction = "up"
If Short MA < Long MA: direction = "down"
If Short MA ≈ Long MA: direction = "neutral"
Trend direction based on MA relationship
3. Calculate Strength
Strength = |Short MA - Long MA| / Long MA × 100
Percentage difference indicating trend strength (0-100+)

The strength value helps traders assess trend quality. A strength of 0-1% suggests a weak or neutral trend, 1-3% indicates a moderate trend, and above 3% suggests a strong, well-established trend. Higher strength values mean the two moving averages are diverging, which typically indicates a stronger trend.

Parameters

ParameterTypeDefaultDescription
shortPeriodnumber10Period for the fast moving average. Responds quickly to price changes. Must be less than longPeriod.
longPeriodnumber50Period for the slow moving average. Provides smoother trend direction. Must be greater than shortPeriod.
sourceNodeAutoThe root data source node to calculate trend from. Automatically detected from connected nodes.

💡 Tip: Common period combinations include 10/50 (default), 20/50, 20/100, or 50/200. Larger spreads (like 10/200) give clearer signals but are slower to react. Smaller spreads (like 10/20) are faster but may whipsaw more in choppy markets.

Output Values

The Trend Direction node provides clear, actionable outputs:

Direction

Values: "up", "down", or "neutral"
"up": Short MA above Long MA - Uptrend detected
"down": Short MA below Long MA - Downtrend detected
"neutral": MAs very close together - No clear trend

Strength

Range: 0 to 100+ (percentage)
0-1%: Weak/neutral trend, high risk of reversal
1-3%: Moderate trend, acceptable for trading
3-5%: Strong trend, good trading conditions
5%+: Very strong trend, high probability setup

Moving Average Lines

The node also outputs both moving average values (shortMA and longMA) which can be visualized on the chart. The crossover points of these lines mark trend direction changes.

Common Use Cases

1. Trend Filter for Entry Signals

Use Trend Direction to filter signals from other indicators. Only take buy signals from oscillators or pattern recognition when direction is "up". Only take sell signals when direction is "down". This simple filter dramatically improves win rates by keeping trades aligned with the trend.

2. Trade Direction Selector

In automated strategies, use the direction output to determine which side of the market to trade. When "up", only look for long opportunities. When "down", only look for short opportunities. When "neutral", stay flat or reduce position sizes.

3. Strength-Based Position Sizing

Scale position sizes based on trend strength. Use full position size when strength is above 3%, half size when strength is 1-3%, and avoid trading when strength is below 1%. This approach concentrates capital in the highest-probability trends.

4. Multi-Timeframe Confirmation

Use multiple Trend Direction nodes with different period settings to confirm trends across timeframes. For example, require both 10/50 and 50/200 to show "up" before taking long positions. This ensures alignment across short-term and long-term trends.

Advantages & Limitations

Advantages

  • Simple, clear output (up/down/neutral)
  • Easy to integrate into automated systems
  • Strength value helps assess trend quality
  • Works on any timeframe and market
  • Lightweight calculation, fast processing
  • Customizable periods for different strategies
!

Limitations

  • Lagging indicator - based on moving averages
  • Can whipsaw in sideways markets
  • Simple logic may miss nuanced market conditions
  • Trend changes detected after they begin
  • Strength calculation can be distorted in volatile markets
  • No built-in overbought/oversold detection

Tips & Best Practices

💡 Use as a Filter, Not a Signal

Trend Direction is best used to filter or confirm signals from other indicators rather than as a standalone entry signal. Combine it with oscillators, patterns, or momentum indicators for complete trading systems. Let other indicators time entries while Trend Direction ensures you're on the right side of the market.

📊 Respect Strength Thresholds

Don't ignore the strength value. Even if direction is clearly "up" or "down", a strength below 1% suggests a weak trend that could reverse quickly. Wait for strength above 2-3% before committing capital. In ranging markets, strength often stays below 1%, signaling to stay out.

⚡ Adjust Periods for Your Style

Day traders might use 5/20 or 10/30 for faster signals. Swing traders work well with 10/50 or 20/100. Position traders prefer 50/200 for major trends. Test different combinations to match your trading timeframe and style. The wider the period gap, the more definitive the trend signal.

⚠️ Watch for Neutral Signals

When direction shows "neutral", it means the market is consolidating or transitioning between trends. This is generally the worst time to trade trend-following strategies. Wait for a clear direction signal before entering new positions, or switch to range-trading approaches during neutral periods.

Example Strategy

Here's a Trend Direction filtering strategy with momentum confirmation:

Trend-Filtered Momentum Strategy

1Setup

  • Connect a Stock Node to Trend Direction node (periods: 10, 50)
  • Add MACD node for entry signals
  • Optional: Add RSI for overbought/oversold confirmation

2Entry Signal (Long)

  • Filter: Trend Direction = "up" AND Strength > 2%
  • Signal: MACD crosses above Signal line
  • Confirmation: RSI is between 40-70 (not overbought)
  • Enter long position on next candle

3Exit Signal

  • Trend Direction changes to "down" or "neutral"
  • Or MACD crosses below Signal line
  • Or Strength drops below 1% (weakening trend)
  • Use trailing stop at recent swing low

4Position Sizing

  • Strength 5%+: Full position size (strong trend)
  • Strength 2-5%: Standard position size (good trend)
  • Strength 1-2%: Half position size (weak trend)
  • Strength <1%: Skip trade (insufficient trend)

Related Nodes