I am looking for an algorithm for detecting swing highs and lows from a candlestick price chart with as little lagging as possible. What's observed as a high/low is slightly subjective, but the following figure gives an example (the green bow indicates that the whole set of candles could be seen as a single swing):
I implemented two solutions so far:
- Detection based on candlestick patterns where a swing is formed by three candles (low - high - low for a top swing). This has little lag but produces many swings.
- Detection of slope sign change from moving average (Hull Moving Average). This generates good swings but with considerable lag and many swings (especially ones close to each other) are omitted.
How can I detect swings with higher accuracy?
Regards,