EMA Breakout Filter Long Only Trading Strategy
This long-only strategy uses an ATR channel to filter fake EMA breakouts for stable trend-following long trades. It focuses solely on long side trading. Strategy Logic: 1. Calculate n-period EMA as intermediate-term…
This long-only strategy uses an ATR channel to filter fake EMA breakouts for stable trend-following long trades. It focuses solely on long side trading.
Strategy Logic:
Calculate n-period EMA as intermediate-term trend.
Calculate n-period ATR for range channel bands.
Go long when price breaks above channel top.
Exit long when price breaks below channel bottom.
ATR channel filters insignificant or short-term false breakouts.
Advantages:
ATR channel improves reliability of long signals.
Long only reduces complexity and risks.
Simple optimization adapts easily across markets.
Risks:
Unable to profit from short-side moves.
Both EMA and ATR lag, causing poor entry timing.
Hard to sustain signals in prolonged ranges.
In summary, this simple system can perform well in bull trends but requires caution on lagging indicators and ranging markets.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_1 | 21 | Length |
Source Pine Script
/*backtest
start: 2020-09-11 00:00:00
end: 2021-04-17 00:00:00
period: 7d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=2
strategy("EMA Long Only Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
len = input(21, minval=1, title="Length")
price = sma(close, 2)
average = ema(close, len)
diff = atr(len)
bull_level = average + diff
bear_level = average - diff
bull_cross = crossover(price, bull_level)
bear_cross = crossover(bear_level, price)
strategy.entry("Buy", strategy.long, when=bull_cross)
strategy.close("Buy", when=bear_cross) //strategy.entry("Sell", strategy.short, when=bear_cross)
plot(price, title="price", color=green, transp=50, linewidth = 4)
plot(average, title="average", color=red, transp=50, linewidth = 4)
a1 = plot(bull_level, title="bull", color=red, transp=50, linewidth = 1)
a2 = plot(bear_level, title="bear", color=red, transp=50, linewidth = 1)
fill(a2, a1, color=red, transp=95)
Published by ChaoZhang on the FMZ strategy square · last modified 2023-09-12. 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/EMA-Breakout-Filter-Long-Only-Trading-Strategy.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
- BB Breakout StrategyPine Script · Breakout · 1d
- Donchian Channel and Larry Williams Large Trade Index StrategyPine Script · Breakout · 1m
- Dual Breakout Volatility Channel StrategyPine Script · Breakout · 1h
- Dual MA Momentum Breakout StrategyPine Script · Breakout · 1h
- EMA and Bollinger Bands Breakout StrategyPine Script · Breakout · 1h
- Flexible Long Short Trading Strategy Based on Keltner ChannelsPine Script · Breakout · 1d