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)
|
Mathematical functions have a variety of uses; it just depends on the user employing them honestly! To answer the first problem in the thread: You can either write a new indicator function for each variable value and then call these values using the Fml() function, but this is slower than the solution I propose below: Code:
prd1:=input("period1",1,1000,5);
prd2:=input("period2",1,1000,10);
prd3:=input("period3",1,1000,15);
pr:=(H+L)/2;
{first pass with prd1}
maxh:=HHV(high,prd1);
minl:=LLV(low,prd1);
{val1:=.33*2*((pr-minl)/(maxh-minl)-.5)+.67*prev; }
val1:=Mov(2*((pr-minl)/(maxh-minl)-.5),5,E);
val2:=If(val1>.99,.999,If(val1<-.99,-.999,val1));
{FT:=.5*Log((1+val2)/(1-val2))+.5*prev; }
FT1:=mov(Log((1+val2)/(1-val2)),3,e);
{2nd pass with prd2}
maxh:=HHV(high,prd2);
minl:=LLV(low,prd2);
val1:=Mov(2*((pr-minl)/(maxh-minl)-.5),5,E);
val2:=If(val1>.99,.999,If(val1<-.99,-.999,val1));
FT2:=mov(Log((1+val2)/(1-val2)),3,e);
{final pass with prd3}
maxh:=HHV(high,prd3);
minl:=LLV(low,prd3);
val1:=Mov(2*((pr-minl)/(maxh-minl)-.5),5,E);
val2:=If(val1>.99,.999,If(val1<-.99,-.999,val1));
FT3:=mov(Log((1+val2)/(1-val2)),3,e);
{binary signal}
FT1>FT3 AND FT3>Ref(FT2,-1);
Notes: * This still isn't what the fisher transofm is designed to do, so this is better named in some way associated with its originator, John Ehlers. * The code has improved performance by removing one PREV and replacing it with its equivalent computation i.e. the 3 period EMA. The val1 variables could be substitued with an EMA if you desired, but it would slightly change the outcome of the indicator (test for yourself). * Reusing the variables saves us from exceeding the 20 variable limit. * Containing the code inside one indicator is faster than making three Fml() calls. Hope this helps. wabbit [:D] P.S. I am rewriting some codes I did some time ago when gruv asked some questions on Ehler's Fisher Transform. I will write another post at some time (maybe, certainly no promises on my time) to demonstrate what the Ehler was talking about when he wrote about the Fisher Transform and pre-conditioning data to display Gaussian (normal) PDF.
|