Hi, I'm looking to write a program that identifies this specific ABC setup when it occurs (see image below). Basically there is a move up to pivot point A. The price drops to pivot point B. It moves up again to a point lower than A, forming point C. Then it drops down again forming a higher low (optionally consolidating for some time, but it doesn't have to) - eventually, it then begins to move up again to point C. This second move to point C is where I want this algorithm to identify this ABC pattern has occured.

Would anyone be able to point me in the right direction on a way I could write this? 

Thanks in advance.

https://i.ytimg.com/vi/ExnfRPnzSmw/hqdefault.jpg