该策略基于艾略特波浪理论,尝试自动检测脉冲波。它通过寻找连续4根收盘价上涨且当前收盘价高于9天前收盘价的K线组合来定义上升脉冲波;用相反的逻辑来定义下降脉冲波。检测到脉冲波后会产生买卖信号并反转仓位,止损位设在信号K线的低点或高点。由于脉冲波通常伴随快速移动,这种止损方式应该会带来正面结果。另外在强趋势开始前,绿色或红色三角形的聚集通常表明趋势启动前平静市场中的良好入场点。
该策略基于经典的艾略特波浪理论,能够捕捉强劲的趋势行情,具有一定的适用性和盈利潜力。但是波浪理论本身的主观性以及脉冲浪的定义等,都可能影响策略表现。在实际应用中,需要注意参数优化、仓位管理、降低交易频率等问题。通过引入趋势确认指标、移动止损、逐步建仓等手段,可以进一步完善该策略的性能和稳定性。
/*backtest start: 2023-04-20 00:00:00 end: 2024-04-25 00:00:00 period: 1d basePeriod: 1h exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ // This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Smollet //@version=5 strategy("LW: 4-9 indicator", overlay = true) consclos = input.int(3, "Consecutive close") daysago = input.int(9, "Days ago") var int long_cc = 0 var int short_cc = 0 long_cc := 1 short_cc := 1 for i = 1 to consclos long_cc := close[i-1] > close[i] ? long_cc*1 : long_cc*0 short_cc := close[i-1] < close[i] ? short_cc*1 : short_cc*0 long_daysago = close > close[daysago] short_daysago = close < close[daysago] long = long_cc ==1 and long_daysago short = short_cc ==1 and short_daysago plotshape(long, style=shape.triangleup, location=location.belowbar, color=color.green) plotshape(short, style=shape.triangledown, location=location.abovebar, color=color.red) //Strategy code if long and strategy.position_size <= 0 strategy.entry("Long", strategy.long) strategy.exit("Long SL", "Long", stop = low) if short and strategy.position_size >= 0 strategy.entry("Short", strategy.short) strategy.exit("Short SL", "Short", stop = high)