# Multi-Timeframe (15m + 1h + 4h) AI Confluence Trading Agent

> Check 3 timeframes simultaneously inside one `execute_code` call using `Promise.all`: require 4h EMA 50 > EMA 200 for macro trend alignment, 1h MACD histogram > 0 for momentum confirmation, and 15m RSI pullback into 38-48 near VWAP for tight-stop entries.

- Canonical URL: https://ai.eterna.exchange/strategies/multi-timeframe-confluence-agent
- Last updated: November 23, 2026
- Author: Eterna Quant & AI Team (Agent Strategy Playbooks)
- MCP endpoint: https://mcp.eterna.exchange/mcp

Single-timeframe indicators whipsaw in choppy crypto markets. Eterna's `execute_code` sandbox lets an AI agent evaluate 4h, 1h, and 15m indicators in parallel in under 200ms without paying for 12 sequential LLM turns.

## Key Facts

| Metric | Value | Notes |
|--------|-------|-------|
| 4h Filter | EMA 50 vs EMA 200 | Macro directional bias |
| 1h Filter | MACD Histogram | Intermediate momentum check |
| 15m Trigger | RSI + VWAP | Precision pullback timing |
| Total LLM Turns | 1 execute_code call | Parallel Promise.all execution |

## 1. Atomic 3-Timeframe Confluence Scanner

### mtf-confluence.ts

```typescript
const symbols = ["BTCUSDT", "ETHUSDT", "SOLUSDT", "SUIUSDT", "NVDAUSDT"];

const scans = await Promise.all(
  symbols.map(async (symbol) => {
    const [ema50_4h, ema200_4h, macd_1h, rsi_15m, vwap_15m, ticker] =
      await Promise.all([
        eterna.getEma({ symbol, interval: "240", period: 50 }),
        eterna.getEma({ symbol, interval: "240", period: 200 }),
        eterna.getMacd({ symbol, interval: "60" }),
        eterna.getRsi({ symbol, interval: "15", period: 14 }),
        eterna.getVwap({ symbol, interval: "15" }),
        eterna.getTickers({ symbol }),
      ]);

    const price = Number(ticker[0].lastPrice);
    const bullish4h = ema50_4h.value > ema200_4h.value;
    const momentum1h = macd_1h.histogram > 0;
    const pullback15m = rsi_15m.value >= 38 && rsi_15m.value <= 48 && price >= vwap_15m.value * 0.996;

    return {
      symbol,
      price,
      bullish4h,
      momentum1h,
      rsi15m: rsi_15m.value,
      setup: bullish4h && momentum1h && pullback15m ? "LONG_CONFLUENCE" : "WAIT",
    };
  }),
);

return scans;
```

## Frequently Asked Questions

### Why does Promise.all inside execute_code beat separate tool calls for MTF analysis?

Fetching 6 calls across 5 symbols equals 30 API reads. Separate tool calls would burn 30 LLM round trips and minutes of stale prices; `execute_code` runs all 30 concurrently in one turn.

## References & Primary Sources

- [Automated Technical Analysis Guide](https://ai.eterna.exchange/guides/automated-technical-analysis-mcp): All 6 native indicator methods documented.

## Related Guides

- [EMA 20/50 Trend-Following AI Crypto Trading Agent (MCP Script)](https://ai.eterna.exchange/strategies/ema-crossover-trend-agent)
- [RSI Mean-Reversion AI Crypto Trading Bot (Runnable MCP Script)](https://ai.eterna.exchange/strategies/rsi-mean-reversion-agent)
- [VWAP Intraday Pullback AI Trading Agent (MCP Script)](https://ai.eterna.exchange/strategies/vwap-intraday-agent)
