Hey.... you are asking for the holy grail
The best way to know whether a market is trending or ranging is to just look at the prices. If you can't tell a trend, then it does not exist. Very simpel.. right?
If you want to use an indicator, the ADX is the one to go with.
Good luck.