20-BAR zero-lagging EMA by Sylvain Vervoort

20-BAR zero-lagging EMA

Period:= Input(“What Period?”,1,100,20);
EMA1:= Mov(CLOSE,Period,E);
EMA2:= Mov(EMA1,Period,E);
Difference:= EMA1 – EMA2;
ZeroLagEMA:= EMA1 + Difference;
ZeroLagEMA


30 Minute OHLC by Roy Larsen

30 Minute OHLC

{for use on 1/5/10/15 minute charts}

{user options}
N:=Input(“Plot 30 Minute OHLC”,0,0,0);
Q:=Input(“User Mode, 0=Static 1=Dynamic 2=Delayed”,0,2,0);

{timing section for longer frames}
A:=Minute(); B:=Hour()*60+A-1; J:=Int(B/30);
G:=LastValue(Highest(A)<=30);
D:=DayOfWeek()<>ValueWhen(2,1,DayOfWeek());
M:=J<>ValueWhen(2,1,J) OR D OR G;
F:=J-ValueWhen(2,1,J)>1 OR (Frac(A/30)=0)*(D=0) OR G;
A:=LastValue(Cum(1)-1)=Cum(1);
B:=ValueWhen(2,1,A);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));

{Prices for longer frames}
Oo:=ValueWhen(1,M,O);
Oo:=ValueWhen(1,J,If(J=1,Oo,ValueWhen(2-G,1,Oo)));
Hh:=HighestSince(1,M,H);
Hh:=ValueWhen(1,J,If(J=1,Hh,ValueWhen(2-G,1,Hh)));
Ll:=LowestSince(1,M,L);
Ll:=ValueWhen(1,J,If(J=1,Ll,ValueWhen(2-G,1,Ll)));
K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
Oo:=ValueWhen(1,Oo>0,Oo);
Hh:=ValueWhen(1,Hh>0,Hh);
Ll:=ValueWhen(1,Ll>0,Ll);

{Build function for longer frames here}

{Plot results}
Oo; Hh; Ll; K; {Frame OHLC}