MetaStock -> Tools -> Indicator Builder -> New Copy and paste formula below. =================== EMA, cycle-adaptive =================== ---8<--------------------------- { Cycle-adaptive Exponential Moving Avg v1.1 } { EMA periodicity determined by historical price cycle based on ZigZag cycles } { ©Copyright 2004 Jose Silva } { http://www.metastocktools.com } pr:=Input("ZigZag cycle reversal %",0,100,5); choose:=Input("EMA periods based on: [1]Cycle, [2]Cycle Avg",1,2,1); multi:=Input("EMA periodicity: Cycle/Avg length x",.1,100,2); x:=Input("use Open=1 High=2 Low=3 Close=4 Volume=5 P=6",1,6,6); shift:=1+Input("EMA vertical shift %", -100,100,0)/100; plot:=Input("[1]EMA [2]Signals [3]Cycle [4]CyAvg [5]CyStdDev",1,6,1); x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,If(x=6,P,C))))); zz:=Zig(x,pr,%); zzpk:=Ref(zz,-1)>zz AND Ref(zz,-1)>Ref(zz,-2); zztr:=Ref(zz,-1)0 AND CycleCount>0,CycleLen),CycleLenAvg)*multi; Init:=CycleCount=1 AND Alert(CycleCount<1,2); pds:= If(pds>BarsSince(Init),BarsSince(Init),pds); pds:=If(pds<1,1,pds); Ema:=x*2/(pds+1)+PREV*(1-2/(pds+1)); Ema:=Ema*shift; signals:=Cross(x,Ema)-Cross(Ema,x); If(plot=1,Ema,If(plot=2,signals, If(plot=3,CycleLen, If(plot=4,CycleLenAvg, If(plot=5,Stdev(CycleLen,21),pds))))) ---8<--------------------------- http://www.metastocktools.com