Rank: Advanced Member
Groups: Registered, Registered Users Joined: 3/19/2005(UTC) Posts: 2,995
Was thanked: 14 time(s) in 10 post(s)
|
We've been trying to come up with an alternative solution to simulate the old code tags. What we've come up with is this: Surround your code in these tags (no brackets and no spaces)
* code *
Insert code here...
* /code *
Should look like this:
Code:
---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)<zz AND Ref(zz,-1)<Ref(zz,-2);
PkTr:=zzpk OR zztr;
CycleLen:=PkTr*(Ref(BarsSince(PkTr),-1)+1);
CycleCount:=Cum(PkTr)-1;
CycleCount:=If(CycleCount=0,.000001,CycleCount);
CycleLenAvg:=Cum(CycleLen)/CycleCount;
pds:=If(choose=1,ValueWhen(1,CycleLen>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<---------------------------
Note: this does not show the custom format in the Preview Window. Just post it and it'll show up.
|