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

Notification

Icon
Error

Options
Go to last post Go to first unread
emiinitrades  
#1 Posted : Wednesday, September 14, 2005 1:03:35 AM(UTC)
emiinitrades

Rank: Newbie

Groups: Registered, Registered Users
Joined: 9/14/2005(UTC)
Posts: 1

Hi, While browsing another forum, I came across an indicator called Tower Line. The indicator was written for a Chinese trading program called FoxTrader. The code is: var1:=CLOSE>CLOSE[1] AND CLOSE>CLOSE[2]; var2:=REF(var1,1) AND CLOSE<=CLOSE[1] AND CLOSE>=CLOSE[2]; var3:=REF(var2,1) AND CLOSE>=CLOSE[1] AND CLOSE<=CLOSE[2]; var4:=REF(var3,1) AND CLOSE<=CLOSE[1] AND CLOSE>=CLOSE[2]; var5:=REF(var4,1) AND CLOSE>=CLOSE[1] AND CLOSE<=CLOSE[2]; var6:=REF(var5,1) AND CLOSE<=CLOSE[1] AND CLOSE>=CLOSE[2]; var7:=REF(var6,1) AND CLOSE>=CLOSE[1] AND CLOSE<=CLOSE[2]; var8:=REF(var7,1) AND CLOSE<=CLOSE[1] AND CLOSE>=CLOSE[2]; var9:=REF(var8,1) AND CLOSE>=CLOSE[1] AND CLOSE<=CLOSE[2]; varA:=REF(var9,1) AND CLOSE<=CLOSE[1] AND CLOSE>=CLOSE[2]; varB:=REF(varA,1) AND CLOSE>=CLOSE[1] AND CLOSE<=CLOSE[2]; varC:=REF(varB,1) AND CLOSE<=CLOSE[1] AND CLOSE>=CLOSE[2]; STICKLINE(var1 OR var2 OR var3 OR var4 OR var5 OR var6 OR var7 OR var8 OR var9 OR varA OR varB OR varC, CLOSE, OPEN, 8,1),color88aeff; varD:=CLOSE<CLOSE[1] AND CLOSE<CLOSE[2]; varE:=REF(varD,1) AND CLOSE>=CLOSE[1] AND CLOSE<=CLOSE[2]; varF:=REF(varE,1) AND CLOSE<=CLOSE[1] AND CLOSE>=CLOSE[2]; var10:=REF(varF,1) AND CLOSE>=CLOSE[1] AND CLOSE<=CLOSE[2]; var11:=REF(var10,1) AND CLOSE<=CLOSE[1] AND CLOSE>=CLOSE[2]; var12:=REF(var11,1) AND CLOSE>=CLOSE[1] AND CLOSE<=CLOSE[2]; var13:=REF(var12,1) AND CLOSE<=CLOSE[1] AND CLOSE>=CLOSE[2]; var14:=REF(var13,1) AND CLOSE>=CLOSE[1] AND CLOSE<=CLOSE[2]; var15:=REF(var14,1) AND CLOSE<=CLOSE[1] AND CLOSE>=CLOSE[2]; var16:=REF(var15,1) AND CLOSE>=CLOSE[1] AND CLOSE<=CLOSE[2]; var17:=REF(var16,1) AND CLOSE<=CLOSE[1] AND CLOSE>=CLOSE[2]; var18:=REF(var17,1) AND CLOSE>=CLOSE[1] AND CLOSE<=CLOSE[2]; STICKLINE(varD OR varE OR varF OR var10 OR var11 OR var12 OR var13 OR var14 OR var15 OR var16 OR var17 OR var18,CLOSE,CLOSE[1],8,0),colorffff00; var19:=REF(varD OR varE OR varF OR var10 OR var11 OR var12 OR var13 OR var14 OR var15 OR var16 OR var17 OR var18,1) AND var1; STICKLINE(var19,CLOSE[1],CLOSE[2],8,0),colorffff00; var1A:=REF(var1 OR var2 OR var3 OR var4 OR var5 OR var6 OR var7 OR var8 OR var9 OR varA OR varB OR varC,1) AND varD; STICKLINE(var1A,CLOSE[1],CLOSE[2],8,1),Color88AEFF; It looks like TLB charts but it's not time compressed and looks like this: UserPostedImage Can this indicator work for Metastock? Thanks for your help.
StorkBite  
#2 Posted : Wednesday, September 14, 2005 4:00:11 AM(UTC)
StorkBite

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 3/19/2005(UTC)
Posts: 2,995

Was thanked: 14 time(s) in 10 post(s)
Hey emiinitrades- Welcome to the forum! First off, I can't solve this problem. However, I thought that if I provided some quick references then maybe someone would take up your cause... Reference: http://www.easychart.net/WebDemos/FormulaHelp.aspxData Array Price:Data Array Price2:Data Array Width:Number Empty:Number
StorkBite  
#3 Posted : Wednesday, September 14, 2005 4:01:50 AM(UTC)
StorkBite

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 3/19/2005(UTC)
Posts: 2,995

Was thanked: 14 time(s) in 10 post(s)
{ converting the simple variables } var1:=C>REF(C,-1) AND C>REF(C,-2); var2:=REF(var1,-1) AND C<=REF(C,-1) AND C>= REF(C,-2); var3:=REF(var2,-1) AND C>=REF(C,-1) AND C<=REF(C,-2); var4:=REF(var3,-1) AND C<=REF(C,-1) AND C>=REF(C,-2); var5:=REF(var4,-1) AND C>=REF(C,-1) AND C<=REF(C,-2); var6:=REF(var5,-1) AND C<=REF(C,-1) AND C>=REF(C,-2); var7:=REF(var6,-1) AND C>=REF(C,-1) AND C<=REF(C,-2); var8:=REF(var7,-1) AND C<=REF(C,-1) AND C>=REF(C,-2); var9:=REF(var8,-1) AND C>=REF(C,-1) AND C<=REF(C,-2); varA:=REF(var9,-1) AND C<=REF(C,-1) AND C>=REF(C,-2); varB:=REF(varA,-1) AND C>=REF(C,-1) AND C<=REF(C,-2); varC:=REF(varB,-1) AND C<=REF(C,-1) AND C>=REF(C,-2); varD:=C<REF(C,-1) AND C<REF(C,-2); varE:=REF(varD,-1) AND C>=REF(C,-1) AND C<=REF(C,-2); varF:=REF(varE,-1) AND C<=REF(C,-1) AND C>=REF(C,-2); var10:=REF(varF,-1) AND C>=REF(C,-1) AND C<=REF(C,-2); var11:=REF(var10,-1) AND C<=REF(C,-1) AND C>=REF(C,-2); var12:=REF(var11,-1) AND C>=REF(C,-1) AND C<=REF(C,-2); var13:=REF(var12,-1) AND C<=REF(C,-1) AND C>=REF(C,-2); var14:=REF(var13,-1) AND C>=REF(C,-1) AND C<=REF(C,-2); var15:=REF(var14,-1) AND C<=REF(C,-1) AND C>=REF(C,-2); var16:=REF(var15,-1) AND C>=REF(C,-1) AND C<=REF(C,-2); var17:=REF(var16,-1) AND C<=REF(C,-1) AND C>=REF(C,-2); var18:=REF(var17,-1) AND C>=REF(C,-1) AND C<=REF(C,-2); { no idea about the stickline function } { ??perhaps closer to simplifying the variables?? } Cond1:= var1 OR var2 OR var3 OR var4 OR var5 OR var6 OR var7 OR var8 OR var9 OR varA OR varB OR varC; STICKLINE(Cond1, C, O, 8, 1); Cond2:= varD OR varE OR varF OR var10 OR var11 OR var12 OR var13 OR var14 OR var15 OR var16 OR var17 OR var18; STICKLINE(Cond2, C, REF(C,-1), 8, 0); Cond3:=REF(Cond2, -1) AND var1; STICKLINE(Cond3, REF(C,-1), REF(C,-2), 8, 0); Cond4:=REF(Cond1, -1) AND varD; STICKLINE(Cond4, REF(C,-1), REF(C,-2), 8, 1);
StorkBite  
#4 Posted : Wednesday, September 14, 2005 4:04:31 AM(UTC)
StorkBite

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 3/19/2005(UTC)
Posts: 2,995

Was thanked: 14 time(s) in 10 post(s)
Perhaps stickline can be replaced with a modified trendline routine such as Jose's?? [code:1:1dbd2869fe]pds:= Input("average trend length periods",2,252,21); pr:=Input("use Open=1 High=2 Low=3 Close=4 Volume=5 MP=6",1,6,4); {define events} pr:=If(pr=1,O,If(pr=2,H,If(pr=3,L,If(pr=5,V, If(pr=6,MP(),C))))); price1:=pr; price2:=pr; time1:=price1>Ref(HHV(price1,pds),-1); time2:=price2<Ref(LLV(price2,pds),-1); {restrict to last events} time1:=time1 AND Cum(time1)=LastValue(Cum(time1)); time2:=time2 AND Cum(time2)=LastValue(Cum(time2)); {sort events} t1pds:=LastValue(BarsSince(time1)); t2pds:=LastValue(BarsSince(time2)); x1:=If(t1pds>=t2pds,time1,time2); x2:=If(t1pds>=t2pds,time2,time1); y1:=If(t1pds>=t2pds,price1,price2); y2:=If(t1pds>=t2pds,price2,price1); {fix coordinates} y1:=ValueWhen(1,x1,y1); y2:=LastValue(ValueWhen(1,x2,y2)); b1:=LastValue(BarsSince(x1)); b2:=LastValue(BarsSince(x2)); plot:=y1+BarsSince(x1)*(y2-y1)/(b1-b2); plot[/code:1:1dbd2869fe]
Jose  
#5 Posted : Wednesday, September 14, 2005 4:28:46 AM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
My understanding of the Chinese languages (or the StickLine function for that matter) is almost zero, but the first problem one would encounter when attempting to translate this EasyChart formula would be the 20-variable limit in Metastock. Leaving StickLines out of it, and hoping that there is no forward referencing in the original formula, this would be the 3-indicator MetaStock equivalent: [code:1:e2ae285936] ============= Tower Line(1) ============= ---8<-------------------------- { up/down conditions } up1:=C>=Ref(C,-1); up2:=C>=Ref(C,-2); dw1:=C<=Ref(C,-1); dw2:=C<=Ref(C,-2); { Pattern conditions } var1:=C>Ref(HHV(C,2),-1); var2:=Ref(var1,-1) AND dw1 AND up2; var3:=Ref(var2,-1) AND up1 AND dw2; var4:=Ref(var3,-1) AND dw1 AND up2; var5:=Ref(var4,-1) AND up1 AND dw2; var6:=Ref(var5,-1) AND dw1 AND up2; var7:=Ref(var6,-1) AND up1 AND dw2; var8:=Ref(var7,-1) AND dw1 AND up2; var9:=Ref(var8,-1) AND up1 AND dw2; varA:=Ref(var9,-1) AND dw1 AND up2; varB:=Ref(varA,-1) AND up1 AND dw2; varC:=Ref(varB,-1) AND dw1 AND up2; { To be referenced in "Tower Line" indicator } If(var1 OR var2 OR var3 OR var4 OR var5 OR var6 OR var7 OR var8 OR var9 OR varA OR varB OR varC, C,O) ---8<-------------------------- ============= Tower Line(2) ============= ---8<-------------------------- { up/down conditions } up1:=C>=Ref(C,-1); up2:=C>=Ref(C,-2); dw1:=C<=Ref(C,-1); dw2:=C<=Ref(C,-2); { Pattern conditions } var1:=C>Ref(HHV(C,2),-1); var2:=Ref(var1,-1) AND dw1 AND up2; var3:=Ref(var2,-1) AND up1 AND dw2; var4:=Ref(var3,-1) AND dw1 AND up2; var5:=Ref(var4,-1) AND up1 AND dw2; var6:=Ref(var5,-1) AND dw1 AND up2; var7:=Ref(var6,-1) AND up1 AND dw2; var8:=Ref(var7,-1) AND dw1 AND up2; var9:=Ref(var8,-1) AND up1 AND dw2; varA:=Ref(var9,-1) AND dw1 AND up2; varB:=Ref(varA,-1) AND up1 AND dw2; varC:=Ref(varB,-1) AND dw1 AND up2; varD:=C<Ref(HHV(C,2),-1); { To be referenced in "Tower Line" indicator } If(Ref(var1 OR var2 OR var3 OR var4 OR var5 OR var6 OR var7 OR var8 OR var9 OR varA OR varB OR varC,-1) OR varD, Ref(C,-1),Ref(C,-2)) ---8<-------------------------- ========== Tower Line ========== ---8<-------------------------- { up/down conditions } up1:=C>=Ref(C,-1); up2:=C>=Ref(C,-2); dw1:=C<=Ref(C,-1); dw2:=C<=Ref(C,-2); var1:=C>Ref(HHV(C,2),-1); varD:=C<Ref(HHV(C,2),-1); varE:=Ref(varD,-1) AND up1 AND dw2; varF:=Ref(varE,-1) AND dw1 AND up2; var10:=Ref(varF,-1) AND up1 AND dw2; var11:=Ref(var10,-1) AND dw1 AND up2; var12:=Ref(var11,-1) AND up1 AND dw2; var13:=Ref(var12,-1) AND dw1 AND up2; var14:=Ref(var13,-1) AND up1 AND dw2; var15:=Ref(var14,-1) AND dw1 AND up2; var16:=Ref(var15,-1) AND up1 AND dw2; var17:=Ref(var16,-1) AND dw1 AND up2; var18:=Ref(var17,-1) AND up1 AND dw2; { Plot on price chart } Fml("Tower Line(1)"); If(varD OR varE OR varF OR var10 OR var11 OR var12 OR var13 OR var14 OR var15 OR var16 OR var17 OR var18, C,Ref(C,-1)); If(Ref(varD OR varE OR varF OR var10 OR var11 OR var12 OR var13 OR var14 OR var15 OR var16 OR var17 OR var18,-1) AND var1, Ref(C,-1),Ref(C,-2)); Fml("Tower Line(2)") ---8<--------------------------[/code:1:e2ae285936] jose '-) http://www.metastocktools.com
StorkBite  
#6 Posted : Wednesday, September 14, 2005 5:07:10 AM(UTC)
StorkBite

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 3/19/2005(UTC)
Posts: 2,995

Was thanked: 14 time(s) in 10 post(s)
Wow Jose, that was quick! :D If nothing else comes of it, know that you're teaching me too... For example, I had no idea there was a 20 variable limit. Plus, the way you combined the variables is neater. Thanks!
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.