This strategy is based on the Elliott Wave Theory and attempts to automatically detect impulse waves. It defines an upward impulse wave by looking for a combination of 4 consecutive up-closing candles where the current close is higher than the close 9 days ago; a downward impulse wave is defined using the opposite logic. Once an impulse wave is detected, it generates buy or sell signals and reverses the position, with the stop loss set at the low or high of the signal candle. Since impulse waves are usually accompanied by rapid movements, this stop loss method should yield positive results. Additionally, the accumulation of green or red triangles before the start of a strong trend often indicates good entry points in a calm market before the trend initiation.
This strategy is based on the classic Elliott Wave Theory and can capture strong trend movements with some applicability and profit potential. However, the subjectivity of wave theory itself and the definition of impulse waves may affect the strategy’s performance. In practical application, attention should be paid to parameter optimization, position management, reducing trading frequency, etc. By introducing trend confirmation indicators, trailing stops, gradual position building, and other means, the performance and stability of this strategy can be further improved.
/*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)