DEMA Crossover Trend Following Strategy
Overview
This strategy is based on the crossover of double exponential moving average (DEMA) as trading signals and adopts a trend following approach with automated stop loss and take profit setting. The advantages of this strategy are clear trading signals, flexible stop loss/take profit configuration and effective risk control.
Strategy Logic
-
Calculate fast DEMA line (8-day), slow DEMA line (24-day) and auxiliary DEMA line (configurable).
-
When fast line crosses above slow line and a gold cross signal is generated, go long. When fast line crosses below slow line and a dead cross signal is generated, go short.
-
Add signal filter that signals are only triggered when the current value of auxiliary line is higher than previous day, avoiding false breakout.
-
Adopt trend following stop loss mechanism where stop loss line keeps adjusting based on price movement, locking in partial profits.
-
At the same time set fixed percentage stop loss and take profit to limit maximum loss and profit per trade.
Advantages
-
Clear trading signals, easy to determine entry and exit timing.
-
Double DEMA algorithm is smoother, avoids overfitting, more reliable signals.
-
Auxiliary line filter improves signal accuracy, reducing false signals.
-
Trend following stop loss locks in partial profits, effectively controlling risks.
-
Fixed percentage stop loss/take profit limits maximum loss per trade, avoids exceeding risk tolerance.
Risks
-
Frequent trading could occur in ranging market, increasing exposure and causing losses.
-
Overly large fixed stop loss percentage may trigger unwanted big stop loss in extreme price swings.
-
DEMA crossover signals lag and long entries at peak may increase loss risks in fast-moving market.
-
In live trading slippage affects profitability, parameter tuning needed.
Enhancement
-
DEMA parameters can be optimized for different market conditions.
-
Consider widening fixed stop loss in live trading to account for slippage costs.
-
Other indicators like MACD can be added to improve signal quality.
-
Fine tune tracking stop loss stepping value to improve logic.
Conclusion
This strategy leverages DEMA's trend detection capability and combines it with trend following risk control methodologies. It is a very typical example in the Determine Trend Direction strategy system. In general this is a strategy with clear signals, sensible stop loss/profit taking configuration and controllable risks. When optimized for slippage costs and added with supplemental indicators in live trading, it can achieve good investment returns.
/*backtest
start: 2024-01-01 00:00:00
end: 2024-01-31 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © zeguela
//@version=4
strategy(title="ZEGUELA DEMABOT", commission_value=0.063, commission_type=strategy.commission.percent, initial_capital=100, default_qty_value=90, default_qty_type=strategy.percent_of_equity, overlay=true, process_orders_on_close=true)- 1

