本策略是基于一目均衡表指标设计的比特币交易策略。它通过计算不同周期的最高价、最低价的均值,形成均衡表,当短周期线穿过长周期线时生成交易信号。
该策略使用一目均衡表指标,具体计算公式如下:
Lmax = period_max周期内的最高价
Smax = period_max周期内的最低价
Lmed = period_med周期内的最高价
Smed = period_med周期内的最低价
Lmin = period_min周期内的最高价
Smin = period_min周期内的最低价
HL1 = (Lmax + Smax + Lmed + Smed)/4
HL2 = (Lmed + Smed + Lmin + Smin)/4
即分别计算长周期线HL1和短周期线HL2的均衡价。当短周期线HL2上穿长周期线HL1时,做多;当短周期线HL2下穿长周期线HL1时,平仓。
该策略具有以下优势:
该策略也存在一些风险:
可以通过适当优化周期参数或结合其他指标来降低这些风险。
该策略可以从以下几个方面进行优化:
本策略基于一目均衡表指标,当短期线突破长期线时产生交易信号。相比单一指标,它可以有效过滤假信号。通过参数优化和风险控制,可以进一步提高策略的稳定性和盈利能力。
/*backtest start: 2023-12-31 00:00:00 end: 2024-01-30 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/ // © Alferow //@version=4 strategy("BTC_ISHIMOKU", overlay=true) period_max = input(20, minval = 1) period_med = input(10, minval = 1) period_min = input(16, minval = 1) Lmax = highest(high, period_max) Smax = lowest(low, period_max) Lmed = highest(high, period_med) Smed = lowest(low, period_med) Lmin = highest(high, period_min) Smin = lowest(low, period_min) HL1 = (Lmax + Smax + Lmed + Smed)/4 HL2 = (Lmed + Smed + Lmin + Smin)/4 p1 = plot(HL1, color = color.red, linewidth = 2) p2 = plot(HL2, color = color.green, linewidth = 2) fill(p1, p2, color = HL1 < HL2 ? color.green : color.red, transp = 90) start = timestamp(input(2020, minval=1), 01, 01, 00, 00) finish = timestamp(input(2025, minval=1),01, 01, 00, 00) trig = time > start and time < finish ? true : false strategy.entry("Long", true, when = crossover(HL2, HL1) and trig) // strategy.entry("Short", false, when = crossunder(HL2, HL1) and trig) strategy.close("Long", when = crossunder(HL2, HL1) and trig)