该策略主要利用最高价、最低价和指数移动平均线(EMA)来确认趋势逆转,从而产生交易信号。策略首先计算指定回看期内的最高价和最低价,然后判断当前收盘价是否低于最高价对应的最低价(看跌逆转确认)或高于最低价对应的最高价(看涨逆转确认)。一旦出现逆转确认信号,策略就会产生相应的开仓信号。该策略的主要优点是能够捕捉趋势逆转的机会,而主要风险则在于逆转确认信号出现后,价格可能出现反复震荡而不是单边趋势行情。
多时间框架逆转确认交易策略通过最高价、最低价和EMA来识别潜在的趋势逆转机会,并产生相应的开仓信号。该策略的优点是能够捕捉趋势逆转,但也存在频繁交易和风险控制不足的问题。通过引入止损止盈、结合其他指标、参数优化和仓位管理等方法,可以进一步提升策略的表现和稳定性。在实际应用中,需要根据具体的交易品种和市场环境来调整策略参数和风控措施。
/*backtest
start: 2023-05-05 00:00:00
end: 2024-05-10 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Reversal Confimation Strategy", overlay=true)
// Indicator inputs
lookback = input.int(50, 'Lookback Period', minval=1, step=1)
downColor = input(color.red, 'Shape Color Down')
upColor = input(color.green, 'Shape Color Up')
// Indicator calculations
find_highest = ta.highest(high, lookback)
find_lowest = ta.lowest(low, lookback)
ema = ta.ema(close, lookback)
var dnRv = 0.0
var dnRv_trigger = false
var upRv = 0.0
var upRv_trigger = false
if high == find_highest
dnRv_trigger := false
if low == find_lowest
upRv_trigger := false
for i = 0 to lookback - 1
if high[i] == find_highest
dnRv := low[i]
for i = 0 to lookback - 1
if low[i] == find_lowest
upRv := high[i]
dnRv_signal = close < dnRv and dnRv_trigger == false
upRv_signal = close > upRv and upRv_trigger == false
if dnRv_signal
dnRv_trigger := true
if upRv_signal
upRv_trigger := true
// Entry and exit conditions
if dnRv_signal
strategy.entry("Sell", strategy.short)
if upRv_signal
strategy.entry("Buy", strategy.long)
// Plotting
plotshape(dnRv_signal ? 1 : 0, style=shape.triangledown, location=location.abovebar, color=downColor, size=size.small)
plotshape(upRv_signal ? 1 : 0, style=shape.triangleup, location=location.belowbar, color=upColor, size=size.small)