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

Notification

Icon
Error

Options
Go to last post Go to first unread
gramario  
#1 Posted : Friday, September 10, 2010 10:37:46 AM(UTC)
gramario

Rank: Newbie

Groups: Registered, Registered Users
Joined: 6/14/2008(UTC)
Posts: 4

Hi I inserted the following into MS recently, but got different results to what he talks of in the article. Did anyone else try this one? Thanks, rupert. METASTOCK: THE CLEAR METHOD Ron Black’s article in this issue, “Getting Clear With Short-Term Swings,” presents an indicator to display the swing line. This can be added to MetaStock with the steps listed here: In the Tools menu, select Indicator Builder. Click New to open the Indicator Editor for a new indicator. Type the name “Swing Line.” Click in the larger window and paste or type in the following formula: upswa:=If(Cum(1)=11, If(H>Ref(H,-1), H, L), If(PREV>=Ref(H,-1) AND ROC(H,1,$)>0, Max(H,PREV), If(PREV<=Ref(L,-1) AND ROC(L,1,$)<0, Min(L,PREV), If(PREV>=Ref(H,-1) AND H<=HHV(L,10), L, If(PREV<=Ref(L,-1) AND L>=LLV(H,10), H, PREV))))); upsw:=If(upswa=H, 1, If(upswa=L, 0, PREV)); If(upsw:=1, HHV(L, 10), LLV(H,10)) Click OK to close the Indicator Editor. Click OK to close Indicator Builder. —William Golson
MetaStock Technical Support
www.MetaStock.com
johnl  
#2 Posted : Friday, September 10, 2010 8:05:24 PM(UTC)
johnl

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 11/7/2005(UTC)
Posts: 602

Can you fix the third line: gives me an error.
gramario  
#3 Posted : Saturday, September 11, 2010 2:01:52 AM(UTC)
gramario

Rank: Newbie

Groups: Registered, Registered Users
Joined: 6/14/2008(UTC)
Posts: 4

Unfortunately, I can't. It gives me an error, too. I have checked the code n the magazine and also on traders.com (where you can download it). rupert
wabbit  
#4 Posted : Saturday, September 11, 2010 4:31:14 AM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
Code:

upswa:=If(Cum(1)=11, If(H>Ref(H,-1), H, L),
If(PREV>=Ref(H,-1) AND ROC(H,1,$)>0, Max(H,PREV), 
If(PREV<=Ref(L,-1) AND ROC(L,1,$)<0, Min(L,PREV),
If(PREV>=Ref(H,-1) AND H<=HHV(L,10), L,
If(PREV<=Ref(L,-1) AND L>=LLV(H,10), H, PREV)))));
upsw:=If(upswa=H, 1, If(upswa=L, 0, PREV));
If(upsw=1, HHV(L, 10), LLV(H,10))


wabbit [:D]

patchau  
#5 Posted : Sunday, September 12, 2010 3:19:56 AM(UTC)
patchau

Rank: Member

Groups: Registered, Registered Users
Joined: 1/25/2010(UTC)
Posts: 13

Was thanked: 1 time(s) in 1 post(s)
Hi,
Just noticed this Clear method thread and have plotted this code together with code from the VSTpro
and there is a difference.
I did query the code with Jose Silva and gained the OK to post it on this forum,

Yesterday I posted several charts using the Clear method on the VSTcharts blog.
The code below was extracted from the VSTpro Clear method template.



{Clear swing method based on S&C article
"Getting Clear With Short-Term Swings":
http://www.traders.com/Documentation/FEEDbk_docs/2010/09/Black.html

Note that the MetaStock "Clear" code as provided by Equis at www.traders.com is incorrect.

Code adapted from VSTpro original code.
http://www.metastocktools.com/vst

Coded by Jose Silva at
http://www.metastocktools.com }


{ ----------- Start of custom code ----------- }

{User inputs}
swUp:=Input("Signals: Minimum UpSwing change %",0,25,0);
swDw:=Input("Signals: Minimum DwSwing change %",0,25,0);
rev:=Input("Reverse trade signals? [1]Yes [0]No",0,1,0);
display:=Input("Display: [1]'Clear' swing line [2]Signals",1,2,1);

{Ignore inside bars, avoid up/dw same-bar clash}
insideBar:=L>Ref(L,-1) AND H<Ref(H,-1);

{Clean price direction signals}
up:=H>Ref(H,-1) AND insideBar=0;
upSignal:=up AND Alert(up=0,2);
dw:=L<Ref(L,-1) AND insideBar=0;
dwSignal:=dw AND Alert(dw=0,2);
init:=Cum(IsDefined(upSignal+dwSignal))=1;
bin:=ValueWhen(1,upSignal-dwSignal<>0 OR init,
upSignal);
up:=bin*(Alert(bin=0,2)
OR upSignal*Cum(upSignal)=1);
dw:=(bin=0)*(Cum(bin)>0)*(Alert(bin,2)
OR dwSignal*Cum(dwSignal)=1);

{Clear Long/Short signals, swing line}
ClearUp:=Cross(L,ValueWhen(1,up,Ref(H,-1)))
AND insideBar=0;
ClearDw:=Cross(ValueWhen(1,dw,Ref(L,-1)),H)
AND insideBar=0;
init:=Cum(IsDefined(ClearUp+ClearDw))=1;
bin:=
ValueWhen(1,ClearUp-ClearDw<>0 OR init,ClearUp);
Clear:=If(bin,HighestSince(1,ClearUp,L),
LowestSince(1,ClearDw,H));

{Swing signals}
entry:=Clear>Ref(Clear,-1)*(1+swUp/100);
exit:=Clear<Ref(Clear,-1)*(1-swDw/100);


{ ------------ End of custom code ------------ }

{Reverse signals choice}
entry1:=entry;
entry:=If(rev,exit,entry1);
exit:=If(rev,entry1,exit);

{Display on price chart}
If(display=1,Clear,entry-exit)

gramario  
#6 Posted : Wednesday, September 15, 2010 3:07:17 AM(UTC)
gramario

Rank: Newbie

Groups: Registered, Registered Users
Joined: 6/14/2008(UTC)
Posts: 4

Tx, Wabbit, Patchau.
ahmedalhosen  
#7 Posted : Sunday, September 2, 2012 2:17:19 PM(UTC)
ahmedalhosen

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 9/2/2012(UTC)
Posts: 24

wabbit wrote:
Code:

upswa:=If(Cum(1)=11, If(H>Ref(H,-1), H, L),
If(PREV>=Ref(H,-1) AND ROC(H,1,$)>0, Max(H,PREV), 
If(PREV<=Ref(L,-1) AND ROC(L,1,$)<0, Min(L,PREV),
If(PREV>=Ref(H,-1) AND H<=HHV(L,10), L,
If(PREV<=Ref(L,-1) AND L>=LLV(H,10), H, PREV)))));
upsw:=If(upswa=H, 1, If(upswa=L, 0, PREV));
If(upsw=1, HHV(L, 10), LLV(H,10))


wabbit [:D]

Thanks wabbit for the code how to convert it to exploration !!!!

regards
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.