Failure Swing

 
Is there a way to code failrure swinsgs? I mean I want to identify failure swings on the chart thru coding.
Reason: