4

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):

enter image description here

I implemented two solutions so far:

  1. 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.
  2. 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,

Hyndrix
  • 4,282
  • 7
  • 41
  • 82
  • Is the graph above the output of one of your codes? Did you tried one of the libraries like scipy? Maybe this is a possible version for you: https://stackoverflow.com/a/50836425/8928659 – TravelTrader Oct 22 '19 at 10:37
  • The blue dots are manually added, the candle sticks are drawn using my own C++ tool. Thanks for the link which looks promising. – Hyndrix Oct 24 '19 at 04:47

0 Answers0