Price Range Breakout Momentum Trading Strategy with EMAs Optimization
This strategy is an intraday trading system that combines previous day's price range breakout with exponential moving averages (EMAs). It identifies trading opportunities when price breaks through the previous day's…

Overview
This strategy is an intraday trading system that combines previous day's price range breakout with exponential moving averages (EMAs). It identifies trading opportunities when price breaks through the previous day's high or low, confirmed by fast and slow EMAs. The strategy focuses on capturing short-term price momentum while managing risk through fixed stop-loss points and risk-reward ratio.
Strategy Principles
The core logic of the strategy is based on the following key elements:
- Using request.security function to obtain the previous day's high and low as key price levels.
- Calculating 9-period and 21-period exponential moving averages (EMAs) as trend confirmation indicators.
- Triggering long signals when price breaks above previous day's high and fast EMA is above slow EMA.
- Triggering short signals when price breaks below previous day's low and fast EMA is below slow EMA.
- Managing risk through fixed stop-loss points (30 points) and risk-reward ratio (2.0) for each trade.
- Optional time filter functionality supporting trading during specific sessions (SAST timezone).
Strategy Advantages
- Clear structure and simple logic: Strategy employs easy-to-understand and execute breakout logic.
- Comprehensive risk management: Implements strict risk control through fixed stop-loss points and risk-reward ratio.
- Flexible time management: Optional time filter allows trading during most active market sessions.
- Multiple confirmation mechanism: Combines price breakout and EMAs trend confirmation to reduce false signals.
- High automation level: Strategy can be fully automated, reducing human intervention.
Strategy Risks
- False breakout risk: Price may quickly retrace after breakout, triggering stop-loss.
- Slippage risk: Actual execution prices may significantly deviate from signal prices during high volatility.
- Fixed stop-loss risk: Fixed point stop-loss may not adapt to all market conditions.
- Market volatility risk: May generate excessive trading signals during low volatility periods.
Strategy Optimization Directions
- Dynamic stop-loss optimization: Consider adjusting stop-loss points based on market volatility.
- Trading time optimization: Optimize trading window settings through historical data analysis.
- Signal filter enhancement: Add volume or volatility indicators as additional filtering conditions.
- EMAs parameter optimization: Determine optimal EMAs periods through backtesting.
- Position management optimization: Introduce volatility-based dynamic position sizing mechanism.
Summary
The strategy implements a reliable intraday trading system by combining price breakout and EMAs trend confirmation. Its core strengths lie in clear logical structure and comprehensive risk management mechanism. Through suggested optimization directions, the strategy can further enhance its stability and profitability. In live trading, special attention should be paid to false breakout and slippage risks, with parameters adjusted according to actual market conditions.
Source Pine Script
/*backtest
start: 2025-02-16 17:00:00
end: 2025-02-18 14:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Binance","currency":"SOL_USDT"}]
*/
//@version=5
strategy("GER40 Momentum Breakout Scalping", overlay=true, initial_capital=10000, default_qty_type=strategy.percent_of_equity, default_qty_value=1)
//---- Input Parameters -----
stopLossPoints = input.int(30, title="Stop Loss (Pips)", minval=1) // Updated to 30 pips
riskReward = input.float(2.0, title="Risk Reward Ratio", step=0.1)
useTimeFilter = input.bool(false, title="Use Time Filter? (Sessions in SAST)")
// Define sessions (SAST) if needed
session1 = "0900-1030"
session2 = "1030-1200"
session3 = "1530-1730"
//---- Time Filter Function -----
inSession = true
if useTimeFilter
// TradingView's session function uses the chart's timezone.
// Adjust the session times if your chart timezone is not SAST.
inSession = time(timeframe.period, session1) or time(timeframe.period, session2) or time(timeframe.period, session3)
//---- Get Previous Day's High/Low -----
// Fetch the previous day's high/low using the daily timeframe. [1] refers to the previous completed day.
prevHigh = request.security(syminfo.tickerid, "D", high[1])
prevLow = request.security(syminfo.tickerid, "D", low[1])
//---- Calculate EMAs on the 1-minute chart -----
emaFast = ta.ema(close, 9)
emaSlow = ta.ema(close, 21)
//---- Define Breakout Conditions -----
longCondition = close > prevHigh and emaFast > emaSlow
shortCondition = close < prevLow and emaFast < emaSlow
//---- Entry & Exit Rules -----
if inSession
// Long breakout: Price breaks above previous day's high
if (longCondition)
strategy.entry("Long", strategy.long)
strategy.exit("Exit Long", "Long",
stop = strategy.position_avg_price - stopLossPoints * syminfo.mintick,
limit = strategy.position_avg_price + stopLossPoints * riskReward * syminfo.mintick)
// Short breakout: Price breaks below previous day's low
if (shortCondition)
strategy.entry("Short", strategy.short)
strategy.exit("Exit Short", "Short",
stop = strategy.position_avg_price + stopLossPoints * syminfo.mintick,
limit = strategy.position_avg_price - stopLossPoints * riskReward * syminfo.mintick)
//---- Plot Indicators & Levels -----
plot(emaFast, color=color.blue, title="EMA 9")
plot(emaSlow, color=color.red, title="EMA 21")
plot(prevHigh, color=color.green, style=plot.style_linebr, title="Prev Day High")
plot(prevLow, color=color.maroon, style=plot.style_linebr, title="Prev Day Low")
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.
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/Price-Range-Breakout-Momentum-Trading-Strategy-with-EMAs-Optimization.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
- Adaptive Multi Period Trading Strategy Based on Wave Trend Momentum BreakoutPine Script · Breakout · 2h
- BB Breakout StrategyPine Script · Breakout · 1d
- BMSB Breakout Strategy BMSBPine Script · Breakout · 1h
- Bollinger Band T3 Moving Average StrategyPine Script · Breakout · 10m
- Bollinger Bands Dual track Breakthrough StrategyPine Script · Breakout · 30m
- Bollinger Breakout StrategyPine Script · Breakout · 30m