JonathanMcFall

Trending/Ranging

This script is a useful tool to use to identify the current market. It includes three other indicators:
1. ATR (combined with a SMA of the ATR)
2. ADX
3. RSI
It allows you to filter for when the market is trending vs. when the market is ranging by using any of the three indicators. You can also combine them to find extremely good trends to trade, or if you're a channel trader, identify when you wouldn't want to trade. This indicator also includes a time frame setting to allow you to ZOOM OUT and explore the long term trend of the security you are trading. I highly recommend using this indicator as a filter for when you enter a trade or not depending on the system you like to trade.
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Comments

What do the other background colors indicate? Your instructions only show a red background. Should the other 2 colors be turned off? Or could you explain them to me?
+1 Reply
@Texsurf73, There is an error in the code that I am working to fix currently that has to do with adding inputs for the colors. The green color is the ATR filter. It is colored when the ATR is above the ATR's 20-period SMA. This indicates higher ATR values, thus a trending market. The red color is the ADX. I can't really explain the math behind the ADX here, but it is colored when the ADX is above 20. 20 is the value that is widely considered to indicate a trending market, but it could be changed to 25 or 30. The yellow color is the RSI, and it is colored when the RSI is greater than 60 or less than 40. As for which colors you should have on, it's personal preference. Honestly, this script is just something I made for myself as a way to filter trades. I would make sure you understand the three indicators that this script uses before you try to use this script to filter your trades.
Reply
Texsurf73 JonathanMcFall
@JonathanMcFall, Thanks! I'm just trying new strategies. Thanks for the explanation!
Reply