logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
jigshir  
#1 Posted : Saturday, September 24, 2016 11:07:34 AM(UTC)
jigshir

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 12/7/2013(UTC)
Posts: 23

Thanks: 1 times

Dear 

all members can anyone resolve this indicator error and thanks in advance 

 

{****************************************}
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

 

This indicator is based on the ZigZag indicator; it returns 1
for a confirmed uptrend and -1 for a confirmed downtrend.

 

so please help to regarding error 

 

mstt  
#2 Posted : Sunday, September 25, 2016 4:08:03 AM(UTC)
mstt

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 The only obvious problem is that quotation marks are of the wrong type. Before and after quotes will translate into an oblong blob when copied into MetaStock. The third quotation mark in the line below should be used at both ends of the comment section of an Input() function. Replace “ and ” with " If there's another problem I can't see it. Roy
thanks 1 user thanked mstt for this useful post.
jigshir on 9/25/2016(UTC)
jigshir  
#3 Posted : Monday, September 26, 2016 11:34:41 AM(UTC)
jigshir

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 12/7/2013(UTC)
Posts: 23

Thanks: 1 times
Dear sir, i apologies i can't resolve so i humble request please correct the error and past complete indicator
mstt  
#4 Posted : Monday, September 26, 2016 11:18:38 PM(UTC)
mstt

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
mstt  
#5 Posted : Monday, September 26, 2016 11:29:10 PM(UTC)
mstt

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 the code from my previous post a minute or two ago back into MetaStock and there is no sign of an error. That suggests that the corruption of the "quotes" characters in you original post occurred when you first copied the code from a text file into MetaStock. Try copying (CTRL/C) the corrected code from my previous post and paste it (CTRL/V) over your failing code. If you still have a problem you should give a more complete explanation of the error. Roy
Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.