Range vs. Trend

I finally have an EA design that trades well with trends, but gets slaughtered on ranging. The only way I was to do a work around is to BE at 40% of the last 3 days ADR. Even then, I’m only managing a gain of about 6% per currency pair per year on back tests.

Any one have any suggestions on how to define ranges through an automated system? I’m considering looking at support/resistance at previous fractals but…are there any other “cleaner” ideas?