The resource loading... loading...

Short-term Down Trend Strategy Based on EMA and Adaptive Fibonacci Retracement

Author: ChaoZhang, Date: 2023-09-21 21:36:16
Tags:

Overview

This strategy uses EMA to determine trend direction and adaptive Fibonacci retracement to automatically identify reversal points, aiming to sell high and buy low by catching down trends. It involves frequent trading suitable for short-term trading.

Strategy Logic

  1. Use 9-day EMA and 21-day EMA golden cross and death cross to determine trend direction. 21-day EMA crossing below 55-day EMA signals a down trend start.

  2. Implement adaptive Fibonacci retracement with 100 periods to automatically determine key retracement levels based on recent price swings.

  3. Price breaking 0.236 Fibonacci retracement indicates a reversal and closes existing position.

  4. When 9-day EMA crosses below 21-day EMA, and price is lower than adaptive Fibonacci high, go short.

  5. Long profit target is a crossover above 200-day EMA. Short stop loss is breaking 0.236 Fibonacci retracement.

Advantages

  • EMA gives clear trend signals, easy to implement

  • Adaptive Fibonacci avoids manual parameter tuning

  • Frequent trading catches short-term moves for high frequency strategies

  • Key retracement levels for timely stop loss

  • Configurable parameters for optimization across cycles

Risks

  • EMA lagging requires confirmation from other indicators

  • Adaptive Fibonacci risks overfitting with unstable levels

  • High frequency trading increases costs from commissions and slippage

  • Ineffective filtering of range-bound trends leads to false signals

  • Needs improvement in drawdown management and risk-reward control

Enhancement

  • Add volume indicators to avoid false signals from price-volume divergence

  • Optimize EMA periods to better fit current market conditions

  • Implement dynamic stop loss for better risk control

  • Incorporate trend strength index to avoid whipsaws

  • Consider trading costs impact and set minimum profit target

Conclusion

This strategy identifies trend direction with EMA and determines reversal levels dynamically using adaptive Fibonacci retracement, which automatically adapts to different market conditions. But it relies more on indicator cues without trend segmentation and Elliott Wave logic, leaving room for optimization. Overall, as a high frequency short-term trading strategy, it can capture fast price changes but involves risks of frequent stop loss and overtrading that traders need to manage.


/*backtest
start: 2023-08-21 00:00:00
end: 2023-09-20 00:00:00
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/
// © CheatCode1

//@version=5
strategy("CC-Trend strategy 2", overlay=true, initial_capital = 10000, commission_type = strategy.commission.percent, commission_value = 0.01, default_qty_type =  strategy.percent_of_equity, default_qty_value = 100 )
ema9 = ta.ema(close, 9)
ema21 = ta.ema(close, 21)
ema55 = ta.ema(close, 55)
ema200 = ta.ema(close, 200)


plot(ema200, '22', color.blue, 2)

FibL = input.int(100, 'Fibonacci Length', 1, 500, group = 'Automatic Fibonacci Retracement')
len1 = input.int(1, 'Show Last', 0, 1000, group = 'Automatic Fibonacci Retracement')
len2 = input.int(5, 'Offset Length', 0, 1000, group = 'Automatic Fibonacci Retracement')

highF = ta.highest(ema55 >= ema9 ? ema55:ema9, FibL)
lowF = ta.lowest(ema55 >= ema9 ? ema9:ema55, FibL)
AvgFib = highF - lowF

//Fibonacci Executions
LL2 = highF + .618 * AvgFib
LL1 = highF + .272 * AvgFib
L1 = highF
L236 = highF - 0.236 * AvgFib
L382 = highF - 0.382 * AvgFib
Mid =  highF - 0.50 * AvgFib
S382 = lowF + 0.382 * AvgFib
S236 = lowF + 0.236 * AvgFib
S1 = lowF
SS1 = lowF - .272 * AvgFib
SS2 = lowF - .618 * AvgFib
//Fibonacci Plot's


high2FP = plot(LL2, 'Highe2', color.red,offset = len2, show_last = len1, trackprice = true)
high1FP = plot(LL1, 'Highe1', color.red,offset = len2, show_last = len1, trackprice = true)
highFP = plot(highF, 'High', color.red,offset = len2, show_last = len1, trackprice = true)
L236P = plot(L236, "0.764", #ED381C, offset = len2, show_last = len1, trackprice = true )
L382P = plot(L382, "0.618", color.white,offset = len2, show_last = len1, trackprice = true )
MidP = plot(Mid, "0.5", color.orange,offset = len2, show_last = len1, trackprice = true )
S382P = plot(S382, "0.382", color.yellow ,offset = len2, show_last = len1, trackprice = true)
S236P = plot(S236, "0.236", color.lime ,offset = len2, show_last = len1, trackprice = true)
lowFP = plot(lowF, 'Low', color.green,offset = len2, show_last = len1, trackprice = true)
low1FP = plot(SS1, 'Lowe1', color.green,offset = len2, show_last = len1, trackprice = true)
low2FP = plot(SS2, 'Lowe2', color.green,offset = len2, show_last = len1, trackprice = true)

plot(ema9, '22', color.yellow, 2)

plot(ema55, '55', color.aqua, 2)

plot(ema200, '200', color.maroon, 2)



shortCondition = close[1] < highF and ema21 < ema55
if (shortCondition)
    strategy.entry("Short", strategy.short)

shorttp = ta.crossover(close, ema200) and strategy.openprofit >= 0
if (shorttp)
    strategy.close('Short', 'Short TP', qty_percent = 100)

shortclose2 = close[1] > L236 and not (shortCondition) 
if(shortclose2)
    strategy.close('Short', 'Short RM', qty_percent = 100)

More