
The Multi-EMA Crossover Trend-Filtered Trading System is an automated trading strategy based on multiple period EMAs (6, 14, 50, 200). This strategy utilizes crossover signals between short-term EMAs (6 and 14) to generate entry points, while using long-term EMAs (50 and 200) to confirm market trend direction, thereby improving trade success rates. The strategy features a fixed USDT position sizing approach combined with percentage-based take profit and stop loss mechanisms for risk control. Additionally, the strategy incorporates trend strength filtering conditions, requiring the distance between EMA50 and EMA200 to reach a minimum percentage difference, ensuring trades are only executed in sufficiently strong trend environments.
The core logic of this strategy is based on a multi-layered exponential moving average confirmation system:
Base Signal Generation: Uses crossovers between EMA6 and EMA14 as initial trading signals. When EMA6 crosses above EMA14, a long signal is generated; when EMA6 crosses below EMA14, a short signal is generated.
Trend Direction Confirmation: Determines the primary market trend through the relative position of EMA50 and EMA200. When EMA50 is greater than EMA200, an uptrend is confirmed; when EMA50 is less than EMA200, a downtrend is confirmed.
Trend Strength Filtering: Calculates the percentage difference between EMA50 and EMA200, allowing trades only when the difference is greater than or equal to a user-defined minimum (default 1.0%), ensuring the trend is strong enough.
Price Position Filtering: Applies additional filtering based on the current price position relative to EMA50 and EMA200. For long positions, price must be above EMA50 or in the “zone” between EMA50 and EMA200; for short positions, price must be below EMA200 or in the “zone” between EMA50 and EMA200.
Position Management: Supports two modes for position sizing - percentage mode (fixed percentage of account equity) or fixed USDT amount mode, with leverage parameter to adjust actual trading size.
Exit Strategy: Provides two take profit modes - percentage-based or EMA cross, while using fixed percentage stop loss to protect capital.
Multiple Confirmation Mechanism: Combines short-term and long-term moving averages to form a layered signal confirmation system, significantly reducing the possibility of false signals. Short-term EMAs capture immediate momentum, while long-term EMAs verify overall trend direction.
Trend Strength Identification: Through percentage difference calculation between EMAs, ensures trading only in sufficiently strong trends, avoiding frequent trading and losses in ranging markets.
Flexible Entry Zones: The strategy allows for “zone trading,” entering positions during pullbacks within the main trend (between EMA50 and EMA200), helping to obtain better entry prices.
Flexible Capital Management: Supports both percentage and fixed amount position sizing models, adapting to traders with different account sizes and risk preferences.
Automated Take Profit and Stop Loss: Built-in percentage-based take profit and stop loss mechanisms achieve automatic risk control, avoiding emotional interference and protecting trading capital.
Alert Integration: Fixed format alerts implemented through alertcondition, facilitating integration with external systems or manual trading assistance.
Cumulative Lag from Multiple Indicators: Using multiple EMAs may lead to cumulative signal lag, potentially missing optimal entry points or responding slowly in rapidly reversing markets. The solution is to consider introducing more sensitive parameters in short-term EMAs or adding momentum indicators as early warnings.
Fixed Parameter Adaptability Issues: The fixed EMA periods (6,14,50,200) in the strategy may not be applicable to all market conditions or timeframes. It is recommended to backtest before actual use and adjust these parameters according to specific market characteristics.
Limitations of Fixed Percentage Take Profit/Stop Loss: Using fixed percentage take profit/stop loss does not account for changes in market volatility; stop losses may be too small in high-volatility environments and too large in low-volatility environments. Consider using ATR (Average True Range) to dynamically adjust take profit and stop loss levels.
Vulnerability at Trend Reversal Points: Near major trend reversal points, EMA crossover signals may frequently produce false signals. Consider adding additional confirmation indicators such as volume, oscillators, or price pattern analysis.
Capital Management Risk: The fixed USDT mode may lead to unreasonable position sizing in markets with significant price fluctuations. Consider implementing a dynamic position adjustment mechanism to adjust the capital proportion for each trade based on market risk.
Dynamic Parameter Adjustment Mechanism: Develop adaptive EMA period settings that automatically adjust EMA parameters based on market volatility or trading cycles, improving strategy adaptability across different market environments. This can be done by incorporating volatility calculation functions, such as changes in ATR values, as a basis for parameter adjustment.
Add Auxiliary Confirmation Indicators: Introduce additional technical indicators such as RSI (Relative Strength Index), MACD (Moving Average Convergence Divergence), or volume indicators as confirmation for crossover signals, reducing the occurrence of false signals.
Intelligent Take Profit/Stop Loss: Replace fixed percentage take profit/stop loss with ATR-based dynamic take profit/stop loss to better adapt to changes in market volatility. For example, stop loss could be set at entry price minus 2 times the current ATR value.
Scaled Entry and Exit Strategy: Implement partial position building and profit-taking strategies instead of all-in-one operations, reducing timing pressure and improving overall profit stability.
Market State Recognition: Add market state classification features (such as trending market, oscillating market) and apply different trading parameters in different market states or even completely avoid certain market states.
Machine Learning Optimization: Introduce simple machine learning algorithms to optimize parameter selection, automatically adjusting the best EMA periods and other parameter combinations based on historical data.
Risk Balancing Mechanism: Implement dynamic position adjustment based on account equity changes, increasing positions after consecutive profits and decreasing positions after consecutive losses, achieving compound growth while controlling drawdown magnitude.
The Multi-EMA Crossover Trend-Filtered Trading System is a comprehensive trading strategy that combines multi-layered EMA indicators, effectively identifying market trends and generating trading signals through the synergy of short-term and long-term moving averages. The core advantages of this strategy lie in its multiple confirmation mechanisms and flexible position management capabilities, making it excel in trending markets.
However, the strategy also has limitations in indicator lag and fixed parameters. Optimization directions mainly focus on dynamic parameter adjustment, adding auxiliary indicators, and improving take profit/stop loss mechanisms. By introducing volatility-aware dynamic parameters and risk management, the strategy can further enhance its adaptability across various market environments.
Overall, this is a clearly structured, logically rigorous trend-following strategy suitable for medium to long-term investors. For aggressive traders, consider shortening EMA periods to increase sensitivity; for conservative traders, consider adding additional filtering conditions and expanding stop loss ranges to reduce trading frequency and risk. In any case, before live trading, it is recommended to thoroughly backtest and adjust parameters according to specific market characteristics and personal risk preferences.
/*backtest
start: 2024-05-20 00:00:00
end: 2024-08-17 00:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"DOGE_USDT"}]
*/
// @version=6
strategy("EMA sabit usdt ve Alarm)", overlay=true, margin_long=1, margin_short=1)
// —— GİRDİLER —— //
fastLen = input.int(6, "EMA6 Periyodu")
slowLen = input.int(14, "EMA14 Periyodu")
midLen = input.int(50, "EMA50 Periyodu")
longLen = input.int(200, "EMA200 Periyodu")
tpMode = input.string("Percent", "Take Profit Modu", options=["Percent", "EMA Cross"])
tpPerc = input.float(2.0, "TP (%)", step=0.1)
slPerc = input.float(7.0, "Stop Loss (%)", step=0.1)
orderSizeMode = input.string("Percent", "Pozisyon Boyutu Modu", options=["Percent", "Fixed"])
orderSizePerc = input.float(10.0, "Boyut (%)", minval=0.1, step=0.1)
orderSizeFixed = input.float(5.0, "Boyut (Sabit) [USDT]", minval=0)
leverage = input.int(1, "Kaldıraç", minval=1)
minEMAPct = input.float(1.0, "%50–200 Min Fark", step=0.1)
// —— EMA HESAPLAMALARI —— //
ema6 = ta.ema(close, fastLen)
ema14 = ta.ema(close, slowLen)
ema50 = ta.ema(close, midLen)
ema200 = ta.ema(close, longLen)
plot(ema6, title="EMA 6", linewidth=1)
plot(ema14, title="EMA 14", linewidth=1)
plot(ema50, title="EMA 50", linewidth=2)
plot(ema200, title="EMA 200", linewidth=2)
crossUp = ta.crossover(ema6, ema14)
crossDown = ta.crossunder(ema6, ema14)
priceAbove50 = close > ema50
priceBelow50 = close < ema50
priceAbove200 = close > ema200
priceBelow200 = close < ema200
upTrend = ema50 > ema200
downTrend = ema50 < ema200
zoneLong = priceBelow50 and priceAbove200
zoneShort = priceAbove50 and priceBelow200
emaDistPct = math.abs(ema50 - ema200) / ema200 * 100
strongTrend= emaDistPct >= minEMAPct
// —— KOŞULLAR —— //
longCond = crossUp and upTrend and strongTrend and (priceAbove50 or zoneLong)
shortCond = crossDown and downTrend and strongTrend and (priceBelow200 or zoneShort)
// —— POZİSYON MİKTARI —— //
var float qty = na
if orderSizeMode == "Percent"
qty := strategy.equity * (orderSizePerc/100) * leverage
else
qty := (orderSizeFixed / close) * leverage
// —— SİNYAL KOŞULLARI — statik mesajlar —— //
alarmLongID = "EMA_Long_Signal"
alarmShortID = "EMA_Short_Signal"
// —— GİRİŞLER —— //
if longCond
strategy.entry("Long", strategy.long, qty=qty)
label.new(bar_index, high, text="Long", yloc=yloc.abovebar)
if shortCond
strategy.entry("Short", strategy.short, qty=qty)
label.new(bar_index, low, text="Short", yloc=yloc.belowbar)
// —— ALERTCONDITION ile sabit mesaj —— //
alertcondition(longCond, title="Long Alarm", message=alarmLongID)
alertcondition(shortCond, title="Short Alarm", message=alarmShortID)
// ÇIKIŞLAR (TP/SL) —— //
if tpMode == "Percent"
if strategy.position_size > 0
slPrice = strategy.position_avg_price * (1 - slPerc/100)
tpPrice = strategy.position_avg_price * (1 + tpPerc/100)
strategy.exit("Exit Long", from_entry="Long", stop=slPrice, limit=tpPrice)
if strategy.position_size < 0
slPrice = strategy.position_avg_price * (1 + slPerc/100)
tpPrice = strategy.position_avg_price * (1 - tpPerc/100)
strategy.exit("Exit Short", from_entry="Short", stop=slPrice, limit=tpPrice)
else
if strategy.position_size > 0
slPrice = strategy.position_avg_price * (1 - slPerc/100)
strategy.exit("Stop Long", from_entry="Long", stop=slPrice)
if strategy.position_size < 0
slPrice = strategy.position_avg_price * (1 + slPerc/100)
strategy.exit("Stop Short", from_entry="Short", stop=slPrice)