突破回调交易策略通过计算价格的绝对强度指标和MACD指标,实现在特定趋势下的突破回调交易,属于短线交易策略。该策略综合多个指标对大趋势、中期趋势和短期趋势进行判断,通过趋势同向且指标互补确认信号,进行趋势跟踪交易。
该策略主要基于价格绝对强度指标和MACD指标实现突破回调交易。首先计算价格的9周期、21周期和50周期EMA,判断大趋势方向;然后计算价格的绝对强度指标,反映短期调整力度;最后计算MACD指标判断短期趋势方向。当大趋势为上涨,且短期出现调整时买入;当大趋势为下跌,且短期出现反弹时卖出。
具体来说,品种大趋势为上涨需满足9日EMA高于21日EMA,21日EMA高于50日EMA。短期调整判断标准为绝对强度指标差值低于0,MACDDIFF小于0。品种大趋势为下跌需满足9日EMA低于21日EMA,21日EMA低于50日EMA。短期反弹判断标准为绝对强度指标差值高于0,MACDDIFF高于0。
该策略具有以下优势:
该策略也存在一些风险:
针对以上风险,可通过优化参数,判断不同周期指标;调整持仓规则,控制单笔亏损;结合更多指标过滤信号,提高准确率等方法进行改进。
该策略可从以下几个方面进行优化:
综上所述,突破回调交易策略整体是一个较为稳定的短线交易策略。它结合大中短多重趋势判断,避免在震荡行情中错误交易。同时指标组合使用也提高了判断的准确性。通过后续的测试和优化,该策略可以成为一个值得长期持有的稳定策略。
/*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"}]
*/
//@version=5
strategy("Divergence Scalper [30MIN]", overlay=true , commission_value=0.04 )
message_long_entry = input("long entry message")
message_long_exit = input("long exit message")
message_short_entry = input("short entry message")
message_short_exit = input("short exit message")
//3x ema
out9 = ta.ema(close,9)
out21 = ta.ema(close,21)
out50 = ta.ema(close,50)
//abs
absolute_str_formula( ) =>
top=0.0
bottom=0.0
if(close>close[1])
top:= nz(top[1])+(close/close[1])
else
top:=nz(top[1])
if(close<=close[1])
bottom:= nz(bottom[1])+(close[1]/close)
else
bottom:=nz(bottom[1])
if (top+bottom/2>=0)
1-1/(1+(top/2)/(bottom/2))
abs_partial=absolute_str_formula()
abs_final = abs_partial - ta.sma(abs_partial,50)
//macd
fast_length = input(title="Fast Length", defval=23)
slow_length = input(title="Slow Length", defval=11)
src = input(title="Source", defval=open)
signal_length = input.int(title="Signal Smoothing", minval = 1, maxval = 50, defval = 6)
sma_source = input.string(title="Oscillator MA Type", defval="EMA", options=["SMA", "EMA"])
sma_signal = input.string(title="Signal Line MA Type", defval="SMA", options=["SMA", "EMA"])
// Calculating
fast_ma = sma_source == "SMA" ? ta.sma(src, fast_length) : ta.ema(src, fast_length)
slow_ma = sma_source == "SMA" ? ta.sma(src, slow_length) : ta.ema(src, slow_length)
macd = fast_ma - slow_ma
signal = sma_signal == "SMA" ? ta.sma(macd, signal_length) : ta.ema(macd, signal_length)
hist = macd - signal
long= abs_final > 0 and hist <0 and out9<out21 and out21<out50
short = abs_final <0 and hist >0 and out9>out21 and out21>out50
long_exit = abs_final <0 and hist >0 and out9>out21 and out21>out50
short_exit = abs_final > 0 and hist <0 and out9<out21 and out21<out50
strategy.entry("long", strategy.long, when = long and barstate.isconfirmed, alert_message = message_long_entry)
strategy.entry("short", strategy.short, when = short and barstate.isconfirmed, alert_message = message_short_entry)
strategy.close("long", when = long_exit and barstate.isconfirmed, alert_message = message_long_exit)
strategy.close("short", when = short_exit and barstate.isconfirmed, alert_message = message_short_exit)