BandPass EOS - 1hThis is a strategy i made for EOS
Opens a long position if the PB line (the red line in the oscillator) crossover the low of the band, the zero line or the top of the band.
If the PB line makes a crossunder in the top of the band, the zero line or the bottom of the band it closes the long position and immediately opens a short position.
Also, the PB value must be higher than 5 candles before if it is a long position and PB must be lower than 5 candles before to open a short position
I got the BandPass Script from www.tradingview.com and made some changes in the configs to adapt the strategy.
If someone has any doubt i can answer below
Bandpass
Template For Custom FIR Filters - Make Your Moving AverageIntroduction
FIR filters (finite impulse response) are widely used in technical analysis, there is the simple or arithmetic moving average, the triangular, the weighted, the least squares...etc. A FIR filter is characterized by the fact that its impulse response (the output of a filter using an impulse as input) is finite, this mean that the impulse response won't have infinite outputs unlike IIR filters.
They are extremely simple to design to, even without the Fourier transform, this is why i post this template that will let you create custom filters from step responses. Don't hesitate to post your results.
How It Works
Originally you create your filters from the frequency response you want your filter to have, this is because the inverse Fourier transform of the frequency response is the filter impulse response.
After that step you use convolution (convolution is the sum of the product between the signal and the impulse response) and you will have your filter. But we don't have Fourier transforms in pine so how can we possibly make FIR filters from convolution ? Well here the thing, the impulse response is the derivative of the step response and the step response is the sum of the impulse response, this mean we can create filters from step responses.
Step response of a moving average.
Step responses are easy to design, you just need a function that start at 0 and end up at 1.
How To Use The Template
All the work is done for you, the only thing you need to do is to enter your function at line 5 :
f(x)=> your function
For example if you want your filter to have a step response equal to sqrt(x) just enter :
f(x)=> sqrt(x)
This will give the following filter output :
You can create custom step responses from online graphing tools like fooplot or wolfram alpha, i recommend fooplot.
You can also design your filter step response from the line 14/15/16, b will be your filter step response, just use a , for example b = pow(a,2) , then replace output in plot by b and use overlay false, you can also plot step , if you like your step response copy the content of b and paste after f(x) => .
Filter Characteristics
The impulse response determine how many of a certain signal you want in your filter, this is also called weighting, you can think of filter design as cooking where your ingredients are the the signal at different periods and the impulse response determine how many of an ingredient you must include in the recipe. The step response can also tell you about your filter characteristics, for example :
This one converge faster to the step function, this mean that the filter will have less lag.
However this one converge slower to the step function, this mean the filter might have more lag but could be smoother.
Be aware that you must find a good weighting balance, else you can have output equals to the signal or just a delayed version of the signal without smoothing.
Real Case
Lets design a sine weighted moving average (swma), this FIR filter use the first 180 degrees of a sine wave function as impulse response.
Impulse response of the swma.
We can design it from the step response without much problems, remember that the impulse response is the derivative of the step response, therefore the derivative of the step response is equal to the first 180 degrees of a sine wave, the derivative of the cosine function is a sine function, therefore :
f(x)=> .5*(1 - cos(x*pi))
And voila.
Designing A BandPass Filter
The bandpass filter like a low-pass and high pass filter, you can think of it as a smooth oscillator.
To design a bandpass filter your step response must be bell shaped, or starting at 0 and ending at 0, for example :
f(x)=>sin(x*pi) give :
Conclusion
Just use fooplot and experiment, you could get nice filters, i will try to post some using this template but it would be really nice to have other people use it. If you need further help pm me.
Thanks for reading !
Combo Backtest 123 Reversal & Bandpass FilterThis is combo strategies for get
a cumulative signal. Result signal will return 1 if two strategies
is long, -1 if all strategies is short and 0 if signals of strategies is not equal.
First strategy
This System was created from the Book "How I Tripled My Money In The
Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
The strategy buys at market, if close price is higher than the previous close
during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50.
The strategy sells at market, if close price is lower than the previous close price
during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
Second strategy
The related article is copyrighted material from
Stocks & Commodities Mar 2010
You can use in the xPrice any series: Open, High, Low, Close, HL2, HLC3, OHLC4 and ect...
WARNING:
- For purpose educate only
- This script to change bars colors.
Combo Strategy 123 Reversal & Bandpass Filter This is combo strategies for get
a cumulative signal. Result signal will return 1 if two strategies
is long, -1 if all strategies is short and 0 if signals of strategies is not equal.
First strategy
This System was created from the Book "How I Tripled My Money In The
Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
The strategy buys at market, if close price is higher than the previous close
during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50.
The strategy sells at market, if close price is lower than the previous close price
during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
Second strategy
The related article is copyrighted material from
Stocks & Commodities Mar 2010
You can use in the xPrice any series: Open, High, Low, Close, HL2, HLC3, OHLC4 and ect...
WARNING:
- For purpose educate only
- This script to change bars colors.
Robust Weighting OscillatorIntroduction
A simple oscillator using a modified lowess architecture, good in term of smoothness and reactivity.
Lowess Regression
Lowess or local regression is a non-parametric (can be used with data not fitting a normal distribution) smoothing method. This method fit a curve to the data using least squares.
In order to have a lowess regression one must use tricube kernel for the weightings w , the weightings are determined using a k-nearest-neighbor model.
lowess is then calculated like so :
Σ (wG(y-a-bx)^2)
Our indicator use G , a , b and remove the square as well as replacing x by y
Conclusion
The oscillator is simple and nothing revolutionary but its still interesting to have new indicators.
Lowess would be a great method to be made on pinescript, i have an estimate but its not that good. Some codes use a simple line equation in order to estimate a lowess smoother, i can describe it as ax + b where a is a smooth oscillator, b some kind of filter defined by lp + bp with lp a smooth low pass filter and bp a bandpass filter, x is a variable dependent of the smoothing span.
Bandpass Filter Strategy ver 2.0 The related article is copyrighted material from
Stocks & Commodities Mar 2010
You can use in the xPrice any series: Open, High, Low, Close, HL2, HLC3, OHLC4 and ect...
You can change long to short in the Input Settings
WARNING:
- For purpose educate only
- This script to change bars colors.
Bandpass Filter Strategy ver 2.0 The related article is copyrighted material from
Stocks & Commodities Mar 2010
You can use in the xPrice any series: Open, High, Low, Close, HL2, HLC3, OHLC4 and ect...
WARNING:
- This script to change bars colors.
Bandpass Filter Strategy The related article is copyrighted material from
Stocks & Commodities Mar 2010
You can use in the xPrice any series: Open, High, Low, Close, HL2, HLC3, OHLC4 and ect...
Bandpass Filter The related article is copyrighted material from
Stocks & Commodities Mar 2010
You can use in the xPrice any series: Open, High, Low, Close, HL2, HLC3, OHLC4 and ect...