Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 600 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
bandpass filter code #479237
03/08/20 22:03
03/08/20 22:03
Joined: Mar 2020
Posts: 19
London
H
hola123 Offline OP
Newbie
hola123  Offline OP
Newbie
H

Joined: Mar 2020
Posts: 19
London
Hi,

I am reading about cycles and am very interested in the topic. The function bandpass seems very powerful but bit of a black box. Is there any code anywhere or if not any code any information on the type of algorithm it is using?

Cheers

Re: bandpass filter code [Re: hola123] #480941
07/26/20 09:37
07/26/20 09:37
Joined: Aug 2016
Posts: 61
D
dr_panther Offline
Junior Member
dr_panther  Offline
Junior Member
D

Joined: Aug 2016
Posts: 61
There is a very good explanation of spectral analysis in the blackbook of JCL, I also think this concepts might be explained in Ehlers book.

Re: bandpass filter code [Re: hola123] #487407
04/10/23 11:46
04/10/23 11:46
Joined: Apr 2023
Posts: 15
R
rki Offline
Newbie
rki  Offline
Newbie
R

Joined: Apr 2023
Posts: 15
I can confirm that the blackbook does not have the code for BandPass filter

Re: bandpass filter code [Re: hola123] #487411
04/10/23 18:43
04/10/23 18:43
Joined: Apr 2023
Posts: 15
R
rki Offline
Newbie
rki  Offline
Newbie
R

Joined: Apr 2023
Posts: 15
Ehler's work has a Roofing Filter that is a BandPass filter. Below is code for that
def RoofingBandPassFilter (vals):
filt = np.ones (len(vals))*vals
hps = np.ones(len(vals))*vals

for i in range (2, len(vals)):
# Highpass filter cyclic components whose periods are shorter tahn 48 bars
# converted cos and sin arguments from degrees to radians as mentioned in the paper
alpha1 = (np.cos(0.0925) + np.sin(0.0925) - 1) / np.cos(0.0925)
hps[i] = ((1.0-alpha1/2.0)**2)*(vals[i]-2*vals[i-1]+vals[i-2]) + 2*(1-alpha1)*hps[i-1] - ((1-alpha1)** 2)*hps[i-2]

# smooth with a super smoother
a1 = np.exp(-1.414 * 3.14159 / 10)
b1 = 2 * a1 * np.cos(0.436)

c3 = -a1 * a1
c1 = 1 - b1 - c3
filt[i] = c1*(hps[i]+hps[i-1])/2 + b1*filt[i-1] + c3*filt[i-2]
return filt

But it does not have the center and width parameters of zorro

Re: bandpass filter code [Re: rki] #487432
04/17/23 19:58
04/17/23 19:58
Joined: Apr 2016
Posts: 38
madpower2000 Offline
Newbie
madpower2000  Offline
Newbie

Joined: Apr 2016
Posts: 38
Book: Cycle analytics for traders : advanced technical trading concepts / John F. Ehlers. 2013
EasyLanguage, Code Listing 5-1.
Code
{
    BandPass Filter
    © 2013 John F. Ehlers
}
Inputs:
    Period(20),
    Bandwidth(.3);
    Vars:
    alpha2(0),
    HP(0),
    gamma1(0),
    alpha1(0),
    beta1(0),
    BP(0),

alpha2 = (Cosine(.25*Bandwidth*360 / Period) + Sine (.25*Bandwidth*360 / Period) - 1) / Cosine(.25*Bandwidth*360 / Period);
HP = (1 + alpha2 / 2)*(Close - Close[1]) + (1- alpha2)*HP[1];
beta1 = Cosine(360 / Period);
gamma1 = 1 / Cosine(360*Bandwidth / Period);
alpha1 = gamma1 - SquareRoot(gamma1*gamma1 - 1);
BP = .5*(1 - alpha1)*(HP - HP[2]) + beta1*(1 + alpha1)*BP[1] - alpha1*BP[2];


Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1