Strategy vault / Trend following
Exponential Moving Average Cross Impulsive Trend Analysis Trading Strategy
This strategy is a trend-following trading system based on Exponential Moving Average (EMA) and Impulse Correction Model (ICM). It captures market trend changes by identifying price-EMA crossovers and subsequent…

Overview
This strategy is a trend-following trading system based on Exponential Moving Average (EMA) and Impulse Correction Model (ICM). It captures market trend changes by identifying price-EMA crossovers and subsequent impulse-correction-impulse patterns, executing trades when specific conditions are met. The system employs a fixed risk-reward ratio to manage stop-loss and take-profit levels for each trade.
Strategy Principles
The core logic of the strategy is based on the following key components:
- Uses 10-period EMA as a reference indicator for trend direction
- Looks for impulse-correction-impulse patterns within 3 periods after price-EMA crossover
- Long entry conditions:
- Price crosses above EMA
- First candle is a bullish impulse (rise exceeds preset value)
- Second candle is a bearish correction (close below open)
- Third candle is a bullish impulse breaking above previous two candles' highs
- Short entry conditions are opposite to long conditions
- Uses fixed risk-reward ratio (default 3x) to automatically set stop-loss and take-profit levels
Strategy Advantages
- Combines technical indicators and price patterns for more reliable trading signals
- Confirms trend continuation through impulse-correction-impulse pattern
- Uses fixed risk-reward ratio for position management, promoting long-term stable returns
- Clear entry logic, easy to understand and execute
- Applicable to different trading instruments and timeframes
Strategy Risks
- May generate frequent false breakout signals in ranging markets
- Fixed risk-reward ratio may not suit all market conditions
- EMA parameters and impulse threshold selection affect strategy performance
- Continuous violent fluctuations may lead to inappropriate stop-loss placement
- Rapid market reversals may cause significant drawdowns
Strategy Optimization Directions
- Introduce volatility indicators to dynamically adjust impulse threshold
- Add trend strength filters to reduce false breakouts
- Dynamically adjust risk-reward ratio based on market characteristics
- Add time filters to avoid trading during unfavorable periods
- Incorporate volume indicators to improve signal reliability
Summary
The strategy constructs a logically clear trend-following system by combining EMA and impulse correction model. Its advantages lie in clear signals and controllable risk, but optimization based on specific market characteristics is still needed. Through adding appropriate filtering conditions and dynamic parameter adjustment mechanisms, the strategy's stability and profitability can be further improved.
Source Pine Script
/*backtest
start: 2024-02-19 00:00:00
end: 2025-02-17 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("EMA Cross Impulsive Strategy", overlay=true, margin_long=100, margin_short=100)
// Parameters
emaLength = input.int(10, title="EMA Length")
impulsiveBodyTicks = input.int(10, title="Minimum Impulsive Candle Body (Ticks)")
rMultiplier = input.int(3, title="Risk Reward Multiplier")
// Calculate EMA
ema10 = ta.ema(close, emaLength)
// Cross conditions
crossUp = ta.crossover(close, ema10)
crossDown = ta.crossunder(close, ema10)
// Impulsive and correction conditions
tickSize = syminfo.mintick
impulsiveBodyMin = impulsiveBodyTicks * tickSize
isImpulsiveBullish = (close > open) and (close - open >= impulsiveBodyMin)
isImpulsiveBearish = (close < open) and (open - close >= impulsiveBodyMin)
isCorrectionBearish = (close < open)
isCorrectionBullish = (close > open)
// Long setup tracking
var int barsSinceLongCross = 0
var bool impulsive1Long = false
var bool correctionLong = false
var bool impulsive2Long = false
if crossUp
barsSinceLongCross := 0
impulsive1Long := false
correctionLong := false
impulsive2Long := false
else
barsSinceLongCross := barsSinceLongCross + 1
if barsSinceLongCross == 1
impulsive1Long := isImpulsiveBullish
if barsSinceLongCross == 2
correctionLong := isCorrectionBearish
if barsSinceLongCross == 3
impulsive2Long := isImpulsiveBullish and (close > math.max(high[1], high[2]))
// Short setup tracking
var int barsSinceShortCross = 0
var bool impulsive1Short = false
var bool correctionShort = false
var bool impulsive2Short = false
if crossDown
barsSinceShortCross := 0
impulsive1Short := false
correctionShort := false
impulsive2Short := false
else
barsSinceShortCross := barsSinceShortCross + 1
if barsSinceShortCross == 1
impulsive1Short := isImpulsiveBearish
if barsSinceShortCross == 2
correctionShort := isCorrectionBullish
if barsSinceShortCross == 3
impulsive2Short := isImpulsiveBearish and (close < math.min(low[1], low[2]))
// Execute trades
if barsSinceLongCross == 3 and impulsive1Long and correctionLong and impulsive2Long
strategy.entry("Long", strategy.long)
strategy.exit("Exit Long", "Long", stop=low, profit=close + (close - low) * rMultiplier)
if barsSinceShortCross == 3 and impulsive1Short and correctionShort and impulsive2Short
strategy.entry("Short", strategy.short)
strategy.exit("Exit Short", "Short", stop=high, profit=close - (high - close) * rMultiplier)
// Plot EMA
plot(ema10, color=color.blue, title="10 EMA")Published by ChaoZhang on the FMZ strategy square · last modified 2025-02-18. 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/Exponential-Moving-Average-Cross-Impulsive-Trend-Analysis-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
- 200 EMA VWAP MFI Trend Following StrategyPine Script · Trend following · 1d
- 4 EMA Trend StrategyPine Script · Trend following · 1d
- ADX MA and EMA Long Only Trend Tracking StrategyPine Script · Trend following · 1d
- ATR Dynamic Trend Following and EMA Crossover Trading StrategyPine Script · Trend following · 1d
- ATR and Moving Average Crossover Hybrid StrategyPine Script · Trend following · 1h
- ATR and T3 Moving Average StrategyPine Script · Trend following · 5m