Type/to search

DEMA Crossover Trend Following Strategy

Common strategy
Created: 2024-02-21 14:10:51
Last modified: 2 years ago
1
Follow
1802
Followers

img

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

  1. Calculate fast DEMA line (8-day), slow DEMA line (24-day) and auxiliary DEMA line (configurable).

  2. 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.

  3. Add signal filter that signals are only triggered when the current value of auxiliary line is higher than previous day, avoiding false breakout.

  4. Adopt trend following stop loss mechanism where stop loss line keeps adjusting based on price movement, locking in partial profits.

  5. At the same time set fixed percentage stop loss and take profit to limit maximum loss and profit per trade.

Advantages

  1. Clear trading signals, easy to determine entry and exit timing.

  2. Double DEMA algorithm is smoother, avoids overfitting, more reliable signals.

  3. Auxiliary line filter improves signal accuracy, reducing false signals.

  4. Trend following stop loss locks in partial profits, effectively controlling risks.

  5. Fixed percentage stop loss/take profit limits maximum loss per trade, avoids exceeding risk tolerance.

Risks

  1. Frequent trading could occur in ranging market, increasing exposure and causing losses.

  2. Overly large fixed stop loss percentage may trigger unwanted big stop loss in extreme price swings.

  3. DEMA crossover signals lag and long entries at peak may increase loss risks in fast-moving market.

  4. In live trading slippage affects profitability, parameter tuning needed.

Enhancement

  1. DEMA parameters can be optimized for different market conditions.

  2. Consider widening fixed stop loss in live trading to account for slippage costs.

  3. Other indicators like MACD can be added to improve signal quality.

  4. 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.

Source
Pine
/*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)
Strategy parameters
Strategy parameters
Source Data
Length DEMA #1
Length DEMA #2
Length DEMA #3
Usar Trailing Stop?
Stop Loss & Take Profit Settings
Stop Loss Long %
Stop Loss Short %
Take Profit Long % 1
Take Profit Short % 1
BackTest Period
Start Date
Start Month
Start Year
End Date
End Month
End Year
Comment
All comments (0)
No data
No data
  • 1
Forums
PINE Language
Get the app
iPhone Download
© 2015 - ∞ INVENTOR PTE LTD (SG)