Sequential Filter - An Original Filtering Approach

Removing irregular variations in the closing price remain a major task in technical analysis , indicators used to this end mostly include moving averages and other kind of low-pass filters. Understanding what kind of variations we want to remove is important, irregular (noisy) variations have mostly a short term period, fully removing them can be complicated if the filter is not properly selected, for example we might want to fully remove variations with a period of 2 bars and lower, if we select an arithmetic moving average the filter output might still contain such variations because of the ripples in the frequency response passband, all it would take is a variation of high amplitude for that variation to be clearly visible.

Although all it would take for better filtering is a filter with better performance in the frequency domain (gaussian, Butterworth, Bessel...) we can design innovative approaches that does not rely on the model of classical moving averages, today a new technical indicator is proposed, the technical indicator fully remove variations lower than the selected period.

The Indicator Approach

In order for the indicator output to change the closing price need to produce length consecutive up's/down's, length control the variation threshold of the indicator, variations lower than length are fully removed. Lets see a visual example :

Here length = 3, the closing price need to make 3 consecutive up's/down's, when the sequence happen the indicator output is equal to src, here the closing price, else the indicator is equal to its precedent value, hence removing other variations. The value of 3 is the value by default, this is because i have seen in the past that the average smallest variations period where in general of 3 bars.

Because the indicator focus only on the variation sign, it totally ignore the amplitude of the movement, this provide an effective way to filter short term retracement in a fluctuation as show'n below :

The candle option of the indicator allow the indicator to only focus on the body color of a candle, thus ignoring potential gaps, below is an example with the candle option off :

If we activate the "candle" option we end up with :

Note that the candle option is based on the closing and opening price, if you use the indicator on another indicator output make sure to have the candle option off.

Length and Indicator Color

The closing price is infected by noise, and will rarely make a large sequence of consecutive up's/down's, the indicator can therefore be useful to detect consecutive sequence of length period, here 6 is selected on BTCUSD :

A consecutive up's/down's of period 6 can be considered a relatively rare event.

It is important to note that the color of the indicator used by default has nothing to do with the consecutive sequence detected, that is the indicator turning red doesn't necessarily mean that a consecutive down's sequence has occurred, but only that this sequence has occurred at a lower value than the precedent detected sequence. This is show'n below :

In order to make the indicator color based on the detected sequence check the "Color Based On Detected Sequence" option.


An original approach on filtering price variations has been proposed, i believe the indicator code is elegant as well as relatively efficient, and since high values of length can't really be used the indicator execution speed will remain relatively fast.

Thanks for reading !
从收藏脚本中删除 添加到收藏脚本
Show your support by donating

BTC : 1J5BQYnx5Wb2akoSfc3ykeShtvmXGsgP6W

ETH : 0xc418eE4039D16EDf44C52dFa292EAbdF117954B3


Hi Alex, Thanks for sharing your Great Work!!!!!!!! Love it!!!!!!!!
+1 回复
Dope, good job
+1 回复
Nice works Alex =D
+1 回复
@ICEKI, thx :3
the tastytrade team definitely agrees that consecutive up/down days are good for 'fading' a move! cool research!
+1 回复
Very interesting read and concept, thanks!!!
首页 股票筛选器 外汇筛选器 加密货币筛选器 财经日历 如何运作 图表功能 价格 推荐朋友 网站规则 帮助中心 网站 & 经纪商解决方案 插件 图表解决方案 轻量图表库 博客 & 新闻 Twitter
概览 个人资料设置 账户和账单 推荐朋友 我的客服工单 帮助中心 已发表观点 粉丝 正在关注 私人消息 聊天 退出