Multi Timeframe EMA Trend Strategy with Daily High Low Breakout System
This is a quantitative trading strategy that combines daily high-low breakouts with multi-timeframe EMA trends. The strategy primarily identifies trading opportunities by monitoring price breakouts of the previous…

Overview
This is a quantitative trading strategy that combines daily high-low breakouts with multi-timeframe EMA trends. The strategy primarily identifies trading opportunities by monitoring price breakouts of the previous day's high and low levels, combined with EMA trends and the Chaikin Money Flow (CMF) indicator. It utilizes 200-period EMAs on both hourly and daily timeframes to enhance trading accuracy through multiple technical indicator validation.
Strategy Principles
The core logic includes the following key elements:
- Uses request.security function to obtain previous day's high and low prices as key support and resistance levels.
- Incorporates 24-period EMA as the baseline for trend determination.
- Implements CMF (20-period) as a comprehensive indicator of volume and price to assess market money flow.
- Calculates 200 EMAs on both current and 1-hour timeframes to determine larger trend directions.
Specific trading rules: Long Entry: Price breaks above previous day's high + Close above EMA + Positive CMF Short Entry: Price breaks below previous day's low + Close below EMA + Negative CMF Exit: Cross below EMA for longs, cross above EMA for shorts
Strategy Advantages
- Multiple technical indicator validation improves trading reliability
- Multi-timeframe analysis provides comprehensive trend assessment
- CMF indicator integration better captures market money flow conditions
- Previous day's high-low levels align with market participants' trading habits
- Clear strategy logic that's easy to understand and execute
- Well-defined entry and exit conditions minimize subjective judgment
Strategy Risks
- May generate frequent false signals in ranging markets
- Not sufficiently responsive to instantaneous price breakouts
- Potential missed opportunities at key levels
- Lacks consideration of larger timeframe trends
- May experience significant drawdowns during extreme market volatility
Risk Control Suggestions:
- Implement appropriate stop-loss levels
- Adjust parameters based on market conditions
- Add trend filters
- Consider incorporating volatility indicators
Optimization Directions
- Implement adaptive parameter optimization mechanisms
- Add more market condition filters
- Optimize stop-loss and take-profit mechanisms
- Include volatility indicators for different market conditions
- Consider position management mechanisms
- Add volume analysis indicators
Summary
This is a complete trading system combining multiple technical indicators and multi-timeframe analysis. The strategy seeks trading opportunities through comprehensive analysis of intraday high-low breakouts, moving average trends, and money flow. While certain risks exist, the strategy holds good practical value through proper risk control and continuous optimization. Traders are advised to conduct thorough backtesting and parameter optimization before live implementation.
Source Pine Script
/*backtest
start: 2024-10-28 00:00:00
end: 2024-11-27 00:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy(title='The security Daily HIGH/LOW strategy', overlay=true, initial_capital=10000, calc_on_every_tick=true,
default_qty_type=strategy.percent_of_equity, default_qty_value=100,
commission_type=strategy.commission.percent, commission_value=0.1)
// General Inputs
len = input.int(24, minval=1, title='Length MA', group='Optimization parameters')
src = input.source(close, title='Source MA', group='Optimization parameters')
out = ta.ema(src, len)
length = input.int(20, minval=1, title='CMF Length', group='Optimization parameters')
ad = close == high and close == low or high == low ? 0 : (2 * close - low - high) / (high - low) * volume
mf = math.sum(ad, length) / math.sum(volume, length)
// Function to get daily high and low
f_secureSecurity(_symbol, _res, _src) =>
request.security(_symbol, _res, _src[1], lookahead=barmerge.lookahead_on)
pricehigh = f_secureSecurity(syminfo.tickerid, 'D', high)
pricelow = f_secureSecurity(syminfo.tickerid, 'D', low)
// Plotting previous daily high and low
plot(pricehigh, title='Previous Daily High', style=plot.style_linebr, linewidth=2, color=color.new(color.white, 0))
plot(pricelow, title='Previous Daily Low', style=plot.style_linebr, linewidth=2, color=color.new(color.white, 0))
// Entry Conditions
short = ta.crossunder(low, pricelow) and close < out and mf < 0
long = ta.crossover(high, pricehigh) and close > out and mf > 0
if short and barstate.isconfirmed
strategy.entry('short', strategy.short, stop=pricelow[1])
strategy.close('short', when=close > out)
if long and barstate.isconfirmed
strategy.entry('long', strategy.long, stop=pricehigh[1])
strategy.close('long', when=close < out)
// 200 EMA on 1-hour timeframe
ema_200 = ta.ema(close, 200)
ema_200_1h = request.security(syminfo.tickerid, "60", ta.ema(close, 200))
plot(ema_200_1h, color=color.purple, title="200 EMA (1H)")
plot(ema_200, color=color.white, title="200 EMA")Published by ChaoZhang on the FMZ strategy square · last modified 2024-11-28. 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/Multi-Timeframe-EMA-Trend-Strategy-with-Daily-High-Low-Breakout-System.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
- Exponential Moving Average Candle Stop Trading StrategyPine Script · Breakout · 1d
- Kana Candle Breakout Strategy Based on Moving Average and Support ResistancePine Script · Breakout · 1h
- Momentum Breakout Moving Average StrategyPine Script · Breakout · 1d
- Momentum Breakout Trading Strategy 435896Pine Script · Breakout · 1d
- Moving Average Crossover and Upper Rail Breakthrough Impulse StrategyPine Script · Breakout · 1m
- Multi Indicator Short Term Algorithmic Trading StrategyPine Script · Breakout · 4h