0bps

Strategy vault / Momentum

Multi Timeframe Exponential Moving Average Momentum Trading Strategy with Volume Weighted Average Price and RSI Confirmation

This strategy is a comprehensive trading system that combines multiple technical indicators to confirm trading signals. The core logic is based on the crossover of fast and slow Exponential Moving Averages (EMA)…

Author
ianzeng123
Complexity
Starter · 61 lines
Parameters
0
Backtest bar
1h · intraday
Tested on
BTC/USDT · spot

IMG IMG

Overview

This strategy is a comprehensive trading system that combines multiple technical indicators to confirm trading signals. The core logic is based on the crossover of fast and slow Exponential Moving Averages (EMA), with signal confirmation through Volume-Weighted Average Price (VWAP) and Relative Strength Index (RSI). The system employs a dynamic stop-loss approach based on Average True Range (ATR) to ensure scientific and flexible risk management.

Strategy Principles

The core principles of the strategy involve the coordination of multiple technical indicators to confirm trading direction. Specifically:

  1. Using 9-period and 21-period EMA crossovers to capture price momentum changes
  2. Utilizing VWAP to determine price position relative to daily average transaction price
  3. Employing RSI to judge market overbought/oversold conditions
  4. Setting dynamic stop-loss positions based on ATR, using 1.5x ATR as the stop-loss distance
  5. Implementing a 2:1 risk-reward ratio for take-profit positions

Strategy Advantages

  1. Comprehensive indicator system reduces false signals through multiple confirmations
  2. Dynamic stop-loss approach adapts to market volatility
  3. Fixed risk-reward ratio promotes long-term stable trading
  4. Integration with institutional traders' VWAP indicator better captures large capital movements
  5. High level of system automation reduces emotional interference

Strategy Risks

  1. May generate frequent false signals in ranging markets
  2. Multiple indicator confirmation might miss some trading opportunities
  3. Fixed risk-reward ratio may lack flexibility in certain market conditions
  4. Technical indicators may fail during significant news events
  5. Trading costs need to be considered for strategy profitability

Strategy Optimization Directions

  1. Introduce volatility indicators to adjust parameters in different market conditions
  2. Add volume analysis to improve signal reliability
  3. Develop adaptive risk-reward ratio system
  4. Incorporate market structure analysis to optimize trade timing
  5. Consider adding fundamental filters to enhance risk resistance

Summary

This strategy constructs a relatively complete trading system through the organic combination of multiple technical indicators. It emphasizes both signal accuracy and risk management importance. While certain limitations exist, through continuous optimization and improvement, the strategy shows promise for maintaining stable performance across various market conditions. The key is to continuously adjust parameters based on actual trading results and flexibly apply the strategy according to changing market environments.

Source Pine Script

/*backtest
start: 2024-02-22 00:00:00
end: 2025-02-19 08:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy("BTC Day Trading Strategy with Alerts", overlay=true)

// Input parameters
emaShortLength = input(9, title="Short EMA Length")
emaLongLength  = input(21, title="Long EMA Length")
rsiLength      = input(14, title="RSI Length")
rsiOverbought  = input(70, title="RSI Overbought Level")
rsiOversold    = input(30, title="RSI Oversold Level")
atrMultiplier  = input(1.5, title="ATR Multiplier for SL")
riskRewardRatio = input(2, title="Risk-Reward Ratio") // Defines TP as 2x SL

// Calculate indicators
emaShort = ta.ema(close, emaShortLength)
emaLong  = ta.ema(close, emaLongLength)
rsi      = ta.rsi(close, rsiLength)
vwap     = ta.vwap(close)  // Fixed: Added "close" as the source
atr      = ta.atr(14)

// Define conditions for entry
longCondition  = ta.crossover(emaShort, emaLong) and close > vwap and rsi > 50
shortCondition = ta.crossunder(emaShort, emaLong) and close < vwap and rsi < 50

// ATR-based Stop Loss & Take Profit
longSL  = close - (atr * atrMultiplier)
longTP  = close + ((close - longSL) * riskRewardRatio)

shortSL = close + (atr * atrMultiplier)
shortTP = close - ((shortSL - close) * riskRewardRatio)

// Execute trades
if (longCondition)
    strategy.entry("Long", strategy.long)
    strategy.exit("Long Exit", from_entry="Long", stop=longSL, limit=longTP)

if (shortCondition)
    strategy.entry("Short", strategy.short)
    strategy.exit("Short Exit", from_entry="Short", stop=shortSL, limit=shortTP)

// ? Add Alert Conditions for TradingView Alerts
alertcondition(longCondition, title="BTC Buy Signal", message="? Buy Signal: 9 EMA crossed above 21 EMA, Price above VWAP, RSI > 50")
alertcondition(shortCondition, title="BTC Sell Signal", message="? Sell Signal: 9 EMA crossed below 21 EMA, Price below VWAP, RSI < 50")

// Plot indicators
plot(emaShort, color=color.blue, title="9 EMA", linewidth=2)  // Thicker line for better visibility
plot(emaLong, color=color.red, title="21 EMA", linewidth=2)    // Thicker line for better visibility
hline(rsiOverbought, "RSI Overbought", color=color.red, linewidth=2)  // Thicker line for RSI Overbought
hline(rsiOversold, "RSI Oversold", color=color.green, linewidth=2)    // Thicker line for RSI Oversold
plot(vwap, color=color.purple, title="VWAP", linewidth=2)            // VWAP line on price chart

// Create a separate panel for RSI for better scaling
plot(rsi, color=color.orange, title="RSI", linewidth=2, style=plot.style_line)  // Plot RSI on a separate panel

Published by ianzeng123 on the FMZ strategy square · last modified 2025-02-21. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.

Build this with AgenKit

A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.

in Claude Code, Cursor, Codex & 4 more
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/Multi-Timeframe-Exponential-Moving-Average-Momentum-Trading-Strategy-with-Volume-Weighted-Average-Price-and-RSI-Confirmation.md
  1. npx agenkit install engineering-kit in your project
  2. Paste the command into your agent and approve each phase
  3. Get tests, backtest, risk controls and a paper-trading switch

Understand it first

Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.

Related specs

esc

Try , , or .

↑↓ move↵ open