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)
|
For readability: Code:pds1:=Input("Short Moving Average periods: ",1,1000,9);
pds2:=pds1*1.6180339887;
pds3:=pds2*1.6180339887;
pdsL1:=LastValue(Rnd(pds1/1.6180339887));
pdsS1:=LastValue(Rnd(pds1-pdsL1));
pdsL2:=LastValue(Rnd(pds2/1.6180339887));
pdsS2:=LastValue(Rnd(pds2-pdsL2));
pdsL3:=LastValue(Rnd(pds3/1.6180339887));
pdsS3:=LastValue(Rnd(pds3-pdsL3));
MA1:=(Mov(C,pdsL1,S)+ValueWhen(1,pdsL1+1,Mov(C,pdsS1,S)))/2;
MA2:=(Mov(C,pdsL2,S)+ValueWhen(1,pdsL2+1,Mov(C,pdsS2,S)))/2;
MA3:=(Mov(C,pdsL3,S)+ValueWhen(1,pdsL3+1,Mov(C,pdsS3,S)))/2;
MA1;
MA2;
MA3;
versus Code:phi:= 1.6180339887; phi1:= 0.6180339887;
pds1:=Input("Short Moving Average periods: ",2,1000,9);
pdsL1:= pds1 / phi; pdsL2:= pds1; pdsL3:= pds1 * phi;
pdsS1:= phi1 * pdsL1; pdsS2:= phi1 * pdsL2; pdsS3:= phi1 * pdsL3;
{convert lengths to static integers} pdsL1:=LastValue(Rnd(pdsL1)); pdsL2:=LastValue(Rnd(pdsL2)); pdsL3:=LastValue(Rnd(pdsL3));
pdsS1:=LastValue(Rnd(pdsS1)); pdsS2:=LastValue(Rnd(pdsS2)); pdsS3:=LastValue(Rnd(pdsS3));
{plot} (Mov(C,pdsL1,S)+Mov(C,pdsS1,S))/2; (Mov(C,pdsL2,S)+Mov(C,pdsS2,S))/2; (Mov(C,pdsL3,S)+Mov(C,pdsS3,S))/2;
|