Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
Hi jigshir
I've copied your code into MetaStock, corrected the quotation marks in each of the Input() functions, and now copied the corrected code into the reply space. Once posted I'll copy the corrected version below back into MetaStock. If the error recurs I'll have to assume that this forum is causing the corruption.
Roy
{****************************************}
vr:=Input("Field (0=Ind/tor, 1=Open, 2=High, 3=Low,
4=Close)",0,4,0);
amnt:=Input("Reversal amount",0.01,1000,10);
md:=Input("Method (1=Percent, 2=Points)",1,2,1);
{****************************************}
vr:=If(vr=1,OPEN,If(vr=2,HIGH,If(vr=3,LOW,If(vr=4,CLOSE,P))));
zz0:=If(md=1, Zig(vr,amnt,%), Zig(vr,amnt,$));
zz1:=Ref(zz0,-1);
zz2:=Ref(zz0,-2);
{****************************************}
tr:=ValueWhen(1,zz0>zz1 AND zz1<zz2, zz1);
pk:=ValueWhen(1,zz0<zz1 AND zz1>zz2, zz1);
PU:=If(md=1,tr+Abs(tr)*amnt/100,tr+amnt);
PD:=If(md=1,pk-Abs(pk)*amnt/100,pk-amnt);
res:=If(vr>=PU AND zz0>zz1,1,
If(vr<=PD AND zz0<zz1,-1,0));
res:=If(res<>0,res,ValueWhen(1,res<>0,res));
res
|