Strategy vault / Mean reversion
Daily Trading Strategy Based on Weekly EMAs
The core idea of this strategy is to map the EMA indicators from weekly timeframe to daily trading, in order to get support from longer term trends and guide daily trading decisions.
Overview
The core idea of this strategy is to map the EMA indicators from weekly timeframe to daily trading, in order to get support from longer term trends and guide daily trading decisions.
Strategy Principle
The strategy first calculates the 6-day, 12-day, 26-day, 52-day EMAs on the daily chart, as well as the 42-day, 84-day, 182-day, 364-day EMAs corresponding to weekly EMA parameter settings.
Then, the crosses of 42-day EMA and 84-day EMA are used to determine the long-term trend; the crosses of 84-day EMA and 182-day EMA are used to determine the medium-term trend.
When shorter period EMA crosses above longer period EMA, go long; when shorter period EMA crosses below longer period EMA, close positions.
Through this mapping method, we get support from weekly level EMA indicators in daily trading, which helps filter some noise and capture larger trend opportunities.
Advantage Analysis
This strategy combines the flexibility of daily trading and the stability of weekly EMAs, with the following advantages:
Weekly EMAs can effectively filter market noise and identify real trend moves. Daily trading can then choose more precise entry based on daily formations.
Weekly EMA parameters are more stable, less affected by short-term price fluctuations. At the same time, daily formations combined with trend judgment result in more timely exits.
EMA crosses can clearly identify cyclical trend reversal points. Profiting from them through daily trading leads to relatively high win rate.
Different period EMA combinations capture trend opportunities across long, medium and short terms.
The strategy has low trading frequency, suitable for long holding. It reduces slippage cost from excessive trading.
Risk Analysis
The main risks of this strategy are:
Weekly EMA entry signals may lag, unable to catch the earliest price change timing.
Exits rely on EMA crosses, without considering formations, volatility etc, may lead to premature exit.
Few EMA crosses tend to result in over extended one-sided holding.
No stop loss means high drawdown risk, requires active human management.
Coarse parameter tuning, needs adjustment for optimal performance on different coins.
Risks can be reduced through:
Identify entry formations with other indicators, take positions ahead of EMA signals.
Add exit rules like stop loss, take profit to avoid over holding.
Optimize EMA periods, test suitable period combos for different coins.
Multi-tier trading, different EMAs for layered positions, lower one-sided holding risk.
Optimization Directions
The strategy can be further optimized in the following aspects:
Add rules on daily entry, like formations, volume etc to filter noise.
Combine stoch, MACD to judge overbought-oversold for finer entry/exit.
Add stop loss, take profit to lower drawdown, lock in profit.
Optimize EMA periods, test combos of different periods.
Try different EMAs like DEMA, TEMA for smoother parameters.
Add position sizing based on different EMA signals.
Research parameters for different trading pairs.
Explore machine learning methods for dynamic EMA optimization.
Conclusion
This is an excellent trend following strategy suitable for long-term holding. It cleverly combines weekly trend judgment and daily execution. With proper enhancements, it can become a very practical multi-timeframe trading system.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_1 | true | From Month |
| v_input_2 | true | From Day |
| v_input_3 | 2017 | From Year |
| v_input_4 | true | To Month |
| v_input_5 | true | To Day |
| v_input_6 | 9999 | To Year |
Source Pine Script
/*backtest
start: 2023-08-20 00:00:00
end: 2023-09-19 00:00:00
period: 3h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=1
strategy("Investing Weekly mapped to Daily", overlay=true, pyramiding=100)
// === PLOTTING EMA ===
plot(ema(close, 6), color=aqua, transp=0, linewidth=2, title="ema6")
plot(ema(close, 12), color=white, transp=0, linewidth=2, title="ema12")
plot(ema(close, 26), color=#9802FF, transp=0, linewidth=2, title="ema26")
plot(ema(close, 52), color=orange, transp=0, linewidth=2, title="ema52")
plot(ema(close, 42), color=aqua, transp=0, linewidth=5, title="W-ema6")
plot(ema(close, 84), color=white, transp=0, linewidth=5, title="W-ema12")
plot(ema(close, 182), color=#9802FF, transp=0, linewidth=5, title="W-ema26")
plot(ema(close, 364), color=orange, transp=0, linewidth=5, title="W-ema52")
// === INPUT BACKTEST RANGE ===
FromMonth = input(defval = 1, title = "From Month", minval = 1, maxval = 12)
FromDay = input(defval = 1, title = "From Day", minval = 1, maxval = 31)
FromYear = input(defval = 2017, title = "From Year", minval = 2017)
ToMonth = input(defval = 1, title = "To Month", minval = 1, maxval = 12)
ToDay = input(defval = 1, title = "To Day", minval = 1, maxval = 31)
ToYear = input(defval = 9999, title = "To Year", minval = 2017)
start = timestamp(FromYear, FromMonth, FromDay, 00, 00) // backtest start window
finish = timestamp(ToYear, ToMonth, ToDay, 23, 59) // backtest finish window
window() => true // create function "within window of time"
// === STRATEGY FOR CRYPTO ===
ema42= ema(close, 42)
ema84= ema(close, 84)
ema182= ema(close, 182)
enterLong1 = cross(ema42, ema84) and ema42 > ema84
exitLong1 = cross(ema42, ema84) and ema42 < ema84
enterLong2 = cross(ema84, ema182) and ema84 > ema182
exitLong2 = cross(ema84, ema182) and ema84 < ema182
strategy.entry(id="Entry_1", long=true, when=enterLong1)
strategy.entry(id="Entry_2", long=true, when=enterLong2)
strategy.entry(id="Exit_1", long=false, when=exitLong1)
strategy.entry(id="Exit_2", long=false, when=exitLong2)
Published by ChaoZhang on the FMZ strategy square · last modified 2023-09-20. 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.
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/Daily-Trading-Strategy-Based-on-Weekly-EMAs.md- npx agenkit install engineering-kit in your project
- Paste the command into your agent and approve each phase
- 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
- 1 2 3 Pattern Quantitative Trading Strategy with EMAs MACD and 4th Candle ExtensionPine Script · Mean reversion · 1h
- ATR and EMA based Dynamic Take Profit and Stop Loss Adaptive StrategyPine Script · Mean reversion · 1h
- Advanced 15 Minute Chart Trading Signal StrategyPine Script · Mean reversion · 3h
- Advanced Momentum EMA Trend Following with RSI Overbought Oversold Trading StrategyPine Script · Mean reversion · 1d
- Advanced Quantitative Trading Strategy Combining RSI Divergence and Moving AveragesPine Script · Mean reversion · 1h
- Advanced Quantitative Trend Following and Cloud Reversal Composite Trading StrategyPine Script · Mean reversion · 1d