[A618] Vortex Indicator Alert Screener [Noise Filtered]This Indicator helps you get alerts from Vortex Indicator if a trend is Established.
One of my followers asked me to do this: @Kiran_05
How this is made ?
1. Vortex Crossovers are taken into consideration in a noise filtered manner
2. Noise filtering is done by trend establishment due to Ehlers 2 pole ButterWorth Filter and EMA50 Crosses
How to use it ?
1. Can be used as a screener on the Script to generate the screened Securities from a Watchlist of Securities
2. Wait for a Candle break above of the generate green signal to get into trade, and vice versa
Credits :
@CheatCountry
For Ehlers 2 Pole Butterworth Filter V2
Hope this Helps
Filter
Band-Pass FilterJust a clean script that can be applied on top of other indicators/sources or you can take the function out of the source and use it in other scripts.
The idea for this was taken from www.pinecoders.com except I am utilizing an EMA instead of SMA. Simply put, we are combining a low-pass filter (moving average) with a high-pass filter (smoothed difference between the source and moving average). The result is a filter/moving average that provides a great combination of minimizing noise while still reacting strongly to price and trend changes.
I like to use this filter in place of other MAs in Pine Scripts to smooth my data. So instead of doing something like sma(stochastic,5) I can easily plug in bp(stochastic,5). It works just fine for your primary moving averages against price as well.
Tool: Chop & Trade ZonesA simple yet powerful way to filter out choppy ranges or sideways moves without missing out on good trades
It calculates the %-distance of the price to a moving average so you can ignore buy/sell signals around the center line.
The upper and lower line are thresholds to catch reversals of the trend when the distance to moving average is increasing.
Thanks @dgtrd and @imzeeshan for the inspiration 🙏
KINSKI Laguerre Filter WaveThe "Laguerre Filter Wave" Indicator usually shows market cycles and is a perfect fit for swing traders who trade with market fluctuations. Upward-trends are shown as green lines and optional bands. Downward trends are represented by the color red. Each of the 18 available lines can be adjusted to your own preferences via a gamma factor.
You also have the following display options:
- "Up/Down Movements: On/Off" - Shows ascending and descending of lines
- "Bands: On/Off" - Fills the space between the lines with colors to indicate up or down trends
- "Bands: Transparency" - sets the transparency of the fill color
- "MA Line: Size" - sets the width of the lines
- "MA Line: Transparency" - sets the transparency of the lines
Index Trend Filter - Weekend Trend TraderThis little script simply gives you a quick visual cue of where price is compared to a particular EMA of another security or underlying index.
It is based on Nick Radge's broader market filter weekend trend trader system, but can be applied to other timeframes if you want to confirm if the index is in an up trend or down trend.
• Green means the underlying index price is above the EMA
• Red means the underlying index price is below the EMA
Ehlers 2 Pole Butterworth Filter V2 [CC]The 2 Pole Butterworth Filter was created by John Ehlers (Cycle Analytics For Traders pg 32) and this is an updated version of his original 2 pole Butterworth Filter script that seems to follow the price even closer. Buy when the indicator line turns green and sell when it turns red.
Let me know if there are other scripts you would like to see me publish or if you want something custom done!
Ehlers 2 Pole Butterworth Filter V1 [CC]The 2 Pole Butterworth Filter was created by John Ehlers (Cybernetic Analysis For Stocks And Futures pg 192) and this is one of his many filters that cuts out the noise and follows the price very closely. I recommend combining a 2 pole and 3 pole system of the same type of filter. Buy when the indicator line is green and sell when it is red.
Let me know if there are other indicators you would like to see or if you want something custom done!
Ehlers Super PassBand Filter [CC]The Super PassBand Filter was created by John Ehlers (Stocks & Commodities V. 34:07 (10–13)) and this is a pretty useful indicator to let you know how volatile the market is right now. This is useful for scalpers because this lets you avoid the choppy markets (usually when the rms is 1.50 or less but feel free to choose your own level) and gives you good entry and exit points. Buy when the indicator line is green and sell when it is red.
Let me know if there are other indicators you would like to see me publish or if you want something custom done!
Ehlers 2 Pole Super Smoother Filter V1 [CC]The 2 Pole Super Smoother Filter was created by John Ehlers (Cybernetic Analysis For Stocks And Futures pg 202) and this one of his filters that follows the price very closely. I would recommend to change the default settings to what fits your trading style the best. Buy when the indicator line turns green and sell when it turns red.
Let me know if there are other scripts you would like to see or if you want something custom done!
Ehlers Laguerre Filter [CC]The Laguerre Filter was created by John Ehlers (Cybernetic Analysis For Stocks And Futures pg 216) and this indicator works well with letting you know both the short and long term trend as well as a pretty good moving average. If the indicator line is above the black line then it is a long term uptrend and below the black line is a long term downtrend. Buy when the indicator line is green and sell when it turns red.
Let me know if there are other scripts you would like to see me publish or if you want something custom done!
Ehlers Roofing Filter [CC]The Roofing Filter was created by John Ehlers (Cycle Analytics For Traders pgs 81-82) and this can be interpreted in a few ways. When the indicator crosses over its signal then it is a short term uptrend and when it crosses below its signal then it is a short term downtrend. It is also in a major uptrend or downtrend when it is above 0 and below 0 respectively. Buy when the indicator line is green and sell when the indicator line turns red.
Let me know if there are other indicators you would like to see me publish or if you want something custom done!
Ehlers Truncated BandPass Filter [CC]Hot off the presses! The Truncated BandPass Filter was created by John Ehlers (Stocks & Commodities July 2020) and this is a much more reactive version of his original bandpass filter. When the indicator rises above 0 then it is an uptrend and when it falls below 0 then it is in a downtrend. Buy when the indicator line is red and sell when it is green.
Let me know if there are other scripts you would like to see me publish or if you want something custom done!
Ehlers HighPass-LowPass Roofing Filter [CC]The HighPass-LowPass Roofing Filter was created by John Ehlers (Cycle Analytics For Traders pg78) and this is a variation of a roofing filter that will let you know which direction the stock is trending. If it falls below 0 then the stock is in a downtrend and if it rises above 0 then it is an uptrend. Buy when the indicator line is green and sell when it is red.
Let me know if there are other scripts you would like me to publish or if you want something custom done!
Ehlers 3 Pole Butterworth Filter [CC]The 3 Pole Butterworth Filter was created by John Ehlers (Cycle Analytics For Traders pg 32) and this is a nice filter that follows the price very closely. Buy when the indicator is green and sell when it turns red.
This was a custom request so let me know if you would like me to publish any other scripts or if you want something custom done!
Ehlers Spectrum Derived Filter Bank [CC]The Spectrum Derived Filter Bank was created by John Ehlers (Stocks & Commodities V. 26:3 (16-22)) and this is technically two indicators in one. This will let you know the current cycle period which is in blue and the other indicator will let you know if you should buy the stock or not. Buy when it is green and sell when it is red.
Let me know if you would like me to publish other scripts or if you want something custom done!
Note: I'm republishing this because the original script couldn't be found in searches so this will fix that.
Ehlers Dominant Cycle Tuned Bypass Filter [CC]The Dominant Cycle Tuned Bypass Filter was created by John Ehlers (Stocks & Commodities V. 26:3 (16-22)) and this is a particularly unique indicator because this does a pretty good job at predicting the future stock movements. If the blue line crosses over the red then a few bars from now the stock price will most likely go up and if the blue line crosses below the red then a few bars from now the stock price should go down. Since this is such a unique indicator to use with entry and exit points, I don't have them color coded but try this out and let me know what you think.
This was a special request so let me know what other scripts you would like to see me publish or if you want anything custom done!
Note: I'm republishing this because the original script couldn't be found in searches so this will fix that.
Ehlers Swiss Army Knife Indicator [CC]The Swiss Army Knife Indicator was created by John Ehlers (Stocks & Commodities V. 24:1 (28-31, 50-53)) and it is 9 different filters in one big mega indicator! This is my first attempt at allowing you all to select different timeframes, to choose if you allow repainting or not, or by letting you choose which indicator you want to see on the chart. I know this may cause problems so feel free to send me a pm if you are stuck or if you have any questions!
This was a custom request so please let me know if you want to see me publish any other scripts or if you want something custom done!
Note: I'm republishing this because the original script couldn't be found in searches so this will fix that.
[LunaOwl] Swing Filter作品: 擺盪濾波器 (Swing Filter)
This is a Swing Filter, the function is to remind you that you do not need to trade during the neutral period, only buy or long when the series is higher than the high-level you set, when the series is lower than the low-level you set, you need to short or hedge. Hope your to use it happily. In a larger time frame, the length can be set smaller, the default value is 100.
這是一個擺盪濾波器,它的功能是提醒您在中性時期不用交易,僅在市場高水平的時候買進持有或做多,當來到低水平時需要做空或對沖。希望使用愉快。此外,在較大的時間框架,期數設定小一點,預設是100。
Long Wick TrialI've created this as a confirmation indicator to help know when market conditions are favorable to enter a trade. It measures volume, volatility, and ATR. It is not intended to tell you when to enter/exit the market, but use it with another indicator such as the mirror macd to filter out many losses and avoid entering the market during low volume or excessive volatility that may trip your stop loss.
Green = Favorable Market conditions
Yellow = Enter with caution, the market is moving sideways but is slightly trending
Orange = Enter with caution, the market is trending but extremely volatile and may trip stop loss early
Black = Shouldn't enter market here, market is moving sideways and volume is also low.
Filter Information Box - PineCoders FAQWhen designing filters it can be interesting to have information about their characteristics, which can be obtained from the set of filter coefficients (weights). The following script analyzes the impulse response of a filter in order to return the following information:
Lag
Smoothness via the Herfindahl index
Percentage Overshoot
Percentage Of Positive Weights
The script also attempts to determine the type of the analyzed filter, and will issue warnings when the filter shows signs of unwanted behavior.
DISPLAYED INFORMATION AND METHODS
The script displays one box on the chart containing two sections. The filter metrics section displays the following information:
- Lag : Measured in bars and calculated from the convolution between the filter's impulse response and a linearly increasing sequence of value 0,1,2,3... . This sequence resets when the impulse response crosses under/over 0.
- Herfindahl index : A measure of the filter's smoothness described by Valeriy Zakamulin. The Herfindahl index measures the concentration of the filter weights by summing the squared filter weights, with lower values suggesting a smoother filter. With normalized weights the minimum value of the Herfindahl index for low-pass filters is 1/N where N is the filter length.
- Percentage Overshoot : Defined as the maximum value of the filter step response, minus 1 multiplied by 100. Larger values suggest higher overshoots.
- Percentage Positive Weights : Percentage of filter weights greater than 0.
Each of these calculations is based on the filter's impulse response, with the impulse position controlled by the Impulse Position setting (its default is 1000). Make sure the number of inputs the filter uses is smaller than Impulse Position and that the number of bars on the chart is also greater than Impulse Position . In order for these metrics to be as accurate as possible, make sure the filter weights add up to 1 for low-pass and band-stop filters, and 0 for high-pass and band-pass filters.
The comments section displays information related to the type of filter analyzed. The detection algorithm is based on the metrics described above. The script can detect the following type of filters:
All-Pass
Low-Pass
High-Pass
Band-Pass
Band-Stop
It is assumed that the user is analyzing one of these types of filters. The comments box also displays various warnings. For example, a warning will be displayed when a low-pass/band-stop filter has a non-unity pass-band, and another is displayed if the filter overshoot is considered too important.
HOW TO SET THE SCRIPT UP
In order to use this script, the user must first enter the filter settings in the section provided for this purpose in the top section of the script. The filter to be analyzed must then be entered into the:
f(input)
function, where `input` is the filter's input source. By default, this function is a simple moving average of period length . Be sure to remove it.
If, for example, we wanted to analyze a Blackman filter, we would enter the following:
f(input)=>
pi = 3.14159,sum = 0.,sumw = 0.
for i = 0 to length-1
k = i/length
w = 0.42 - 0.5 * cos(2 * pi * k) + 0.08 * cos(4 * pi * k)
sumw := sumw + w
sum := sum + w*input
sum/sumw
EXAMPLES
In this section we will look at the information given by the script using various filters. The first filter we will showcase is the linearly weighted moving average (WMA) of period 9.
As we can see, its lag is 2.6667, which is indeed correct as the closed form of the lag of the WMA is equal to (period-1)/3 , which for period 9 gives (9-1)/3 which is approximately equal to 2.6667. The WMA does not have overshoots, this is shown by the the percentage overshoot value being equal to 0%. Finally, the percentage of positive weights is 100%, as the WMA does not possess negative weights.
Lets now analyze the Hull moving average of period 9. This moving average aims to provide a low-lag response.
Here we can see how the lag is way lower than that of the WMA. We can also see that the Herfindahl index is higher which indicates the WMA is smoother than the HMA. In order to reduce lag the HMA use negative weights, here 55% (as there are 45% of positive ones). The use of negative weights creates overshoots, we can see with the percentage overshoot being 26.6667%.
The WMA and HMA are both low-pass filters. In both cases the script correctly detected this information. Let's now analyze a simple high-pass filter, calculated as follows:
input - sma(input,length)
Most weights of a high-pass filters are negative, which is why the lag value is negative. This would suggest the indicator is able to predict future input values, which of course is not possible. In the case of high-pass filters, the Herfindahl index is greater than 0.5 and converges toward 1, with higher values of length . The comment box correctly detected the type of filter we were using.
Let's now test the script using the simple center of gravity bandpass filter calculated as follows:
wma(input,length) - sma(input,length)
The script correctly detected the type of filter we are using. Another type of filter that the script can detect is band-stop filters. A simple band-stop filter can be made as follows:
input - (wma(input,length) - sma(input,length))
The script correctly detect the type of filter. Like high-pass filters the Herfindahl index is greater than 0.5 and converges toward 1, with greater values of length . Finally the script can detect all-pass filters, which are filters that do not change the frequency content of the input.
WARNING COMMENTS
The script can give warning when certain filter characteristics are detected. One of them is non-unity pass-band for low-pass filters. This warning comment is displayed when the weights of the filter do not add up to 1. As an example, let's use the following function as a filter:
sum(input,length)
Here the filter pass-band has non unity, and the sum of the weights is equal to length . Therefore the script would display the following comments:
We can also see how the metrics go wild (note that no filter type is detected, as the detected filter could be of the wrong type). The comment mentioning the detection of high overshoot appears when the percentage overshoot is greater than 50%. For example if we use the following filter:
5*wma(input,length) - 4*sma(input,length)
The script would display the following comment:
We can indeed see high overshoots from the filter:
@alexgrover for PineCoders
Look first. Then leap.
Filter Amplitude Response Estimator - A Simple CalculationIn digital signal processing knowing how a system interact with the frequency content of an input signal is extremely important, the mathematical tool that give you this information is called "frequency response". The frequency response regroup two elements, the amplitude response, and the phase response. The amplitude response tells you how the system modify the amplitude of the frequency components in the input signal, the phase response tells you how the system modify the phase of the frequency components in the signal, each being a function of the frequency.
The today proposed tool aim to give a low resolution representation of the amplitude response of any filter.
What Is The Amplitude Response Of A Filter ?
Remember that filters allow to interact with the frequency content of a signal by amplifying, attenuating and/or removing certain frequency components in the input signal, the amplitude (also called magnitude) response of a filter let you know exactly how your filter change the amplitude of the frequency components in the input signal, another way to see the amplitude response is as a tool that tell you what is the peak amplitude of a filter using a sinusoid of a certain frequency as input signal.
For example if the amplitude response of a filter give you a value of 0.9 at frequency 0.5, it means that the filter peak amplitude using a sinusoid of frequency 0.5 is equal to 0.9.
There are several ways to calculate the frequency response of a filter, when our filter is a FIR filter (the filter impulse response is finite), the frequency response of the filter is the absolute value of the discrete Fourier transform (DFT) of the filter impulse response.
If you are curious about this process, know that the DFT of a N samples signal return N values, so if our FIR filter coefficients are composed of only 5 values we would get a frequency response of 5 values...which would not be useful, this is why we "pad" our coefficients with zeros, that is we add zeros to the start and end of our series of coefficients, this process is called "zero-padding", so if our series of coefficients is: (1,2,3,4,5), applying zero padding would give (0,0...1,2,3,4,5,...0,0) while keeping a certain symmetry. This is related to the concept of resolution, a low resolution amplitude response would be composed of a low number of values and would not be useful, this is why we use zero-padding to add more values thus increasing the resolution.
Making a Fourier transform in Pinescript is not doable, as you need the complex number i for computing a DFT, but thats not even the only problem, a DFT would not be that useful anyway (as the processes to make it useful in a trading context would be way too complex) . So how can we calculate a filter amplitude response without using a DFT ? The simple answer is by taking the peak amplitude of a filter using a sinusoid of a certain frequency as input, this is what the proposed tool do.
Using The Tool
The proposed tool give you a 50 point amplitude response from frequency 0.005 to 0.25 by default. the setting "Range Divisor" allow you to see the amplitude response by using a different range of frequency, for example if the range divisor is equal to 2 the filter amplitude response will be evaluated from frequency 0.0025 to 0.125.
In the script, filt hold the filter you want to see the frequency response, by default a simple moving average.
The position of the frequency response is defined by the "Show Amplitude Response At Bar Number" setting, if you want the frequency response to start at bar number 5000 then enter 5000, by default 10000. If you are not a premium set the number at 4000 and it should work.
amplitude response of a simple moving average of period 14, res = 2.
By default the amplitude response use an amplitude scale, a value of 1 represent an unchanged amplitude. You can use Dbfs (decibel full scale) instead by checking the "To Decibels (Full Scale)" setting.
Dbfs amplitude response, a value of 0 represent an unchanged amplitude.
Some Amplitude Responses
In order to prove the accuracy of the proposed tool we can compare the amplitude response given by the proposed tool with the mathematical function of the amplitude response of a simple moving average, that is:
abs(sin(pi*f*length)/(length*sin(pi*f)))
In cyan the amplitude response given by the proposed tool and in blue the above function. Below are the amplitude responses of some moving averages with period 14.
Amplitude response of an EMA, the EMA is a IIR filter, therefore the amplitude response can't be made by taking the DFT of the impulse response (as this ones has infinite length), however our tool can give its frequency response.
Amplitude response of the Hull MA, as you can see some frequencies are amplified, this is common with low-lag filters.
Gaussian moving average (ALMA), with offset = 0.5 and sigma = 6.
Simple moving average high-pass filter amplitude response
Center of gravity bandpass filter amplitude response
Center of gravity bandreject filter.
IMPORTANT!: The amplitude response of adaptive moving averages is not stationary and might change over time.
Conclusion
A tool giving the amplitude response of any filter has been presented, of course this method is not efficient at all and has a low resolution of 50 points (the common resolution is of 512 points) and is difficult to work with, but has the merit to work on Tradingview and can give the frequency response of IIR filters, if you really need to see the frequency response of a filter then i recommend you to use the function freqz from the scipy package.
I still hope you will enjoy using this tool to have a look at the amplitude responses of your favorite moving averages.
I'am aware of the current situation, however i'am somehow feeling left out from the pinescript community, let me know via PM if i have done something to you and i'll do my best to fix any problems i might have caused (or i might be being parano xD)
Sequential Filter - An Original Filtering ApproachRemoving 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.
Conclusion
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 !