Range Filter [DW]

This is an experimental study designed to filter out minor price action for a clearer view of trends.

Inspired by the QQE's volatility filter, this filter applies the process directly to price rather than to a smoothed RSI .

First, a smooth average price range is calculated for the basis of the filter and multiplied by a specified amount.
Next, the filter is calculated by gating price movements that do not exceed the specified range.
Lastly the target ranges are plotted to display the prices that will trigger filter movement.

Custom bar colors are included. The color scheme is based on the filtered price trend.
版本注释: Updates:

-> Migrated to v4.
-> Range Filter and the bands are now calculated in a singular function.
-> There are now two different calculation methods for the filter. Select the type you want to use via the "Filter Type" input. Type 1 is the original formula.
-> Multiple range sizing methods are now available. You can choose from the following scales:
- Points
- Pips (Works best with forex pairs, obviously)
- Ticks
- % of Price
- Average Change (Default. This is the original sizing method.)
- Standard Deviation
- Absolute (Absolute numerical value)
-> Range smoothing is now optional, and you can specify your smoothing length. Smoothing only affects dynamic scales (ATR, Average Change, and Standard Deviation).
-> Filter movement can now be determined using wicks or close. This can be specified via the "Movement Source" input.
-> Stability Fix: Added correction for NaN values to stabilize initial states.
-> Reorganized the script structure.
-> Revamped the color scheme.
版本注释: Updates:

- The Range Filter functions have now been rebuilt using Pine's awesome new array functions.

- Standard deviation calculation has been adjusted to calculate the same as TV's built in stdev() function.

- Rewritten filter direction and bar color variables.

- Included an external output variable for trend information that can easily be sent to other scripts without hardcoding.
The output format is 1 for bullish, and -1 for bearish.
To use this external variable with another script, simply select it from your other script's source dropdown tab.

- Added the ability to average range filter values based on a user defined number of filter changes.
This averaging method utilized the Conditional Sampling EMA function I introduced in my Resampling Filter Pack and only takes a new sample when the filter changes its value.
This opens up a whole new world of possible filter outputs.

本着真正的TradingView精神,该脚本的作者将其开源发布,因此交易者可以理解和验证它。为作者加油! 您可以免费使用它,但是在发布中重复使用此代码受网站规则的约束。您可以收藏它以在图表上使用。

For my full list of premium tools, check the blog:

Reach out on Telegram:


Such an incredible script! Great job and thanks for what you are doing for this community man, please keep it up!
500 代币
+2 回复
@carnagecain, hi could u pls spare a moment and help me understand how this works?
carnagecain embarrassedAnt94068
@embarrassedAnt94068, I would recommend checking out @DonovanWall Resampling Filter Pack, it’s got some additional features. This is a fairly advanced script and not something I could explain quickly in a message board, past what he already put in his write-ups. I would focus on researching the portions you don’t understand individually so you can understand the combined techniques he is using.
@carnagecain, thanks for your response but i really have no clue what Resampling Filter Pack is doing. is it supertrend? i only wanted to know if above the green is a buy and below the red is a short trade. are these entry/exit cues?
embarrassedAnt94068 embarrassedAnt94068
@embarrassedAnt94068, honestly i dont want to go into the techniques. i just need to know the entry/exit signals so i could maybe combine this with ADX +Di and -Di to better time my entries and exit.
embarrassedAnt94068 embarrassedAnt94068
@embarrassedAnt94068, so if -Di line crosses above 25 and the script shows close below the red line i go for a short entry and if +Di crosses above 25 and close is above green line I go long. This is what i want to ask.
This indicator is perfection. So far my favourite on this platform. Thanks!
+5 回复
Congrats to the developer for this superb indicator. I would like to program an alert whenever the filter goes red or green, but as far as I understand, it has a lot of invisible changes in color (cross between Color0 and Color1), and therefore it causes to many noise/false-signals. How can I make an alert that corresponds to the visual core trend Color0 /Color1 cross? Thanks
+3 回复
DonovanWall aciriaco
@aciriaco, There aren't invisible transitions in the color. If you want to code signals for when filter direction changes, you need to use the upward and downward variables. These vars save the last directional state of the filter.
To make the signals, you can use a conditions like these:

bull_sig = upward==0 and upward
bear_sig = downward==0 and downward

That will signal the change in var states.
+2 回复
aciriaco DonovanWall
@DonovanWall, thanks but no signal is triggered with the bull_sig and bear_sig as you stated. Made it work with a cross(upward,downward). Keep the good codes coming!!
首页 股票筛选器 外汇筛选器 加密货币筛选器 财经日历 关于 图表功能 价格 推荐朋友 网站规则 帮助中心 网站 & 经纪商解决方案 插件 图表解决方案 轻量图表库 博客 & 新闻 Twitter
概览 个人资料设置 账户和账单 推荐朋友 代币 我的客服工单 帮助中心 私人消息 在线聊天 退出