I'm trying to write an online algorithm in Python to detect this below Down-Up-Down pattern in time-series.
It's not hard to do roughly if I calculate 3 contiguous non-overlapping moving averages, and just check that the first and last are both < -X
, and the middle one is > 1.5*X
.
But this has many downsides. For example, the time frames need to be strictly hardcoded. And, it ignores intrawindow variation that may obviously invalidate the overall pattern if a human were to eyeball it as a sense check.
What can I do? Wavelets aren't ideal because of edge effects .. I need an online algorithm that computes in real-time.