AlgoHive
Examples

Multi-Timeframe Strategy

Use higher timeframes for trend direction and lower timeframes for entry timing.

Professional traders often use multiple timeframes: a higher timeframe for trend direction and a lower timeframe for precise entries.

ℹ️Advanced Example

This strategy uses multiple data sources and analysis blocks. See the MA Crossover and RSI Mean Reversion examples for visual previews of simpler strategies.

The Concept

Higher timeframe (1D): Determines trend direction — only trade in the direction of the daily trend.

Lower timeframe (4h): Times entries — enter on pullbacks within the larger trend.

The idea: align with the bigger picture while optimizing entry timing.

Strategy Setup

Data Sources

Daily data for trend:

SettingValue
Aliasbtc_1d
TypeExchange
SymbolBTC-USD
Timeframe1d

4-hour data for entries:

SettingValue
Aliasbtc_4h
TypeExchange
SymbolBTC-USD
Timeframe4h

Analysis Block: daily_trend

Analyze the higher timeframe:

ema_50: EMA(btc_1d.close, 50)
ema_200: EMA(btc_1d.close, 200)
uptrend: ema_50 > ema_200
downtrend: ema_50 < ema_200
trend_strength: ADX(btc_1d.high, btc_1d.low, btc_1d.close, 14)
strong_trend: trend_strength > 25

Analysis Block: entry_signals

Lower timeframe entry logic:

rsi: RSI(btc_4h.close, 14)
pullback_buy: rsi < 40 AND rsi > rsi[1]
pullback_sell: rsi > 60 AND rsi < rsi[1]
fast_ema: EMA(btc_4h.close, 9)
slow_ema: EMA(btc_4h.close, 21)
momentum_up: fast_ema > slow_ema
momentum_down: fast_ema < slow_ema

Analysis Block: combined

Combine timeframes:

long_setup: daily_trend.uptrend AND daily_trend.strong_trend AND entry_signals.pullback_buy AND entry_signals.momentum_up
short_setup: daily_trend.downtrend AND daily_trend.strong_trend AND entry_signals.pullback_sell AND entry_signals.momentum_down

Entry Rules

Long Entry:

SettingValue
DirectionLong
Marketbtc_4h
Whencombined.long_setup

Short Entry:

SettingValue
DirectionShort
Marketbtc_4h
Whencombined.short_setup

Risk Management

Stop Loss:

SettingValue
TypeStop Loss
LevelATR-based expression
ATR(btc_4h.high, btc_4h.low, btc_4h.close, 14) * 2

Take Profit:

SettingValue
TypeTake Profit
Level3R (risk multiple)

Move Stop to Breakeven:

SettingValue
TypeMove Stop
WhenPOSITION_PNL_R() > 1
ToBreakeven

Strategy Logic Explained

Why Multiple Timeframes?

  1. Reduces noise — Daily trend filters out 4h false signals
  2. Better timing — 4h provides precise entries within daily trend
  3. Higher probability — Trading with the trend, not against it
  4. Clear invalidation — If daily trend changes, strategy adapts

Entry Conditions

For a long entry, we need:

  1. Daily EMAs show uptrend (50 > 200)
  2. Daily ADX > 25 (strong trend)
  3. 4h RSI pulled back and turning up
  4. 4h EMAs confirm momentum

This is a high-bar entry that waits for alignment.

Risk Management

  • ATR-based stop adapts to current volatility
  • 3R target ensures good risk-reward
  • Move to breakeven after 1R to protect capital

Variations

Add Volume Confirmation

volume_expansion: btc_4h.volume > SMA(btc_4h.volume, 20) * 1.3
long_setup: daily_trend.uptrend AND entry_signals.pullback_buy AND volume_expansion

Weekly + Daily + 4h

Add a weekly timeframe for the major trend:

btc_1w: BTC-USD weekly
major_uptrend: EMA(btc_1w.close, 10) > EMA(btc_1w.close, 30)

Then require major_uptrend AND daily_trend.uptrend for longs.

Divergence Detection

Add RSI divergence on the daily:

price_higher_high: btc_1d.high > HIGHEST(btc_1d.high[1], 10)
rsi_lower_high: daily_trend.rsi < HIGHEST(daily_trend.rsi[1], 10)
bearish_divergence: price_higher_high AND rsi_lower_high

Timeframe Selection

Common combinations:

Higher TFLower TFStyle
WeeklyDailyPosition trading
Daily4hSwing trading
4h1hActive trading
1h15mDay trading

Rule of thumb: Lower timeframe should be 3-6x smaller than higher timeframe.

Backtest Considerations

Multi-timeframe strategies typically show:

MetricTypical Range
Win Rate45-55%
Profit Factor1.3-2.0
Trade FrequencyLow (high bar for entry)
Hold TimeDays to weeks

Fewer trades but higher quality setups.

Tips

  1. Be patient — Multi-timeframe setups are rare but valuable
  2. Trust the higher timeframe — Don't override daily signals with 4h noise
  3. Use the lower TF for timing only — Direction comes from higher TF
  4. Watch for timeframe conflicts — When they disagree, stay out
  5. Consider correlation — If trading multiple pairs, check they're not all the same setup

On this page