Rank: Advanced Member
Groups ready for retrieval: Registered, Registered Users, Subscribers, Unverified Users Joined: 8/11/2005(UTC) Posts: 104
|
Hi,
If I include the last two terms in the Butterworth equation
i.e. { + coef2*Butter[1] + coef3*Butter[2]
; }
as (coef2*PREV)
I
get an error “overflow in Multi[]
Function “
Is there anyway to overcome this problem
Hoping hat you can oblige
Derek
Code:
{ 2 Pole Butterworth Filter }
Data:=((H+L)/2);
Period:=Input("Period",5,175,175);
a1:=Exp(-1.414*3.14159/Period);
b1:=2*a1*Cos(1.414*180/Period);
coef2:=b1;
coef3:=-a1*a1;
coef1:=(1-b1+a1*a1)/4;
Butter:= coef1*(Data+2*Ref(Data,-1)+Ref(Data,-2))
{+ coef2*Butter[1] + coef3*Butter[2];};
If(Cum(1)<3 , Butter=Data,butter);
Butter;
{
………………………………………………….
Original code
Input: Price((H+L)/2), Period(15);
a1=expvalue(-1.414*3.14159/Period);
b1=2*a1*Cosine(1.414*180/Period);
coef2=b1;
coef3=-a1*a1;
coef1=(1-b1+a1*a1)/4;
Butter = coef1*(Price+2*Price[1]+Price[2])+
coef2*Butter[1] + coef3*Butter[2];
If CurrentBar<3 then Butter=Price;
Plot1(Butter,"Butter");
…………………………………………….
}
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers, Unverified Users Joined: 10/28/2004(UTC) Posts: 3,111 Location: Perth, Western Australia
Was thanked: 16 time(s) in 16 post(s)
|
This is why I have the MDK! Have you tried: Code:
Butter:= coef1*(Data+2*Ref(Data,-1)+Ref(Data,-2)) + coef2*PREV + coef3*Ref(PREV,-1);
It will be VERY slow!
|
|
|
|
Rank: Advanced Member
Groups ready for retrieval: Registered, Registered Users, Subscribers, Unverified Users Joined: 8/11/2005(UTC) Posts: 104
|
Hi Wabbit,
The speed is quite reasonable!
Thank you again ..that is great.
Derek
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.