In all my time developing systems for the Financial Markets I saw a lot of people complain about having difficulties detecting sideways markets programmatically.
So I thought to share the method I'm using and being very satisfied with it. It is certainly not perfect, especially after a big move. But in the end it doesn't need to be perfect to work.
The algorithm is based on the assumption that the markets always move sideways, except when they are not.
I hope it helps you.
Attached Image (click to enlarge)
Attached Image (click to enlarge)
Attached File
SidewaysDetector.mq4 8 KB | 2 downloads | Uploaded Jan 15, 2018 7:25pm