[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Metastockusers] Re: Schaff Trend Cycle Indicator



PureBytes Links

Trading Reference Links

Will the Schaffer Cycle formulas, as written here work in MetaStock
version 7.03?

Thanks,

Jim Barone

-----Original Message-----
From: praktikus_ms [mailto:praktikus@xxxxxxxxxx] 
Sent: Wednesday, October 15, 2003 12:52 PM
To: Metastockusers@xxxxxxxxxxxxxxx
Subject: [Metastockusers] Re: Schaff Trend Cycle Indicator

Hi Michael,

I'm not exactly sure for what platform you are looking for the code 
but in the thread you copied from www.terminmarktwelt.de (a site I 
greatly reccomend to those who understand german) is the Metastock 
code for the Schaff TC Indicator. Below you find the pure code

> Schaffer Cycle
> 
> Cycle:=Input("Schaff Cycle",1,100,10);
> SH:=Input("Short Period",5,50,23);
> LG:=Input("Long Period",20,200,50);
> MCD := Wilders( typical(),Sh) - Wilders( typical(),Lg); 
> ST := ((MCD-LLV(MCD,Cycle)) / (HHV(MCD,Cycle)-LLV(MCD,Cycle))) 
*100; 
> STC := Wilders(ST,Cycle/2);
> stc

This code is for an expert:


> Schaffer Expert
> 
> Highlight Red:
> Cycle:=10;
> SH:=23;
> LG:=50;
> MCD := Wilders( typical(),Sh) - Wilders( typical(),Lg); 
> ST := ((MCD-LLV(MCD,Cycle)) / (HHV(MCD,Cycle)-LLV(MCD,Cycle))) 
*100; 
> STC := Wilders(ST,Cycle/2);
> Cross(75,stc)
> 
> 
> Highlight green:
> Cycle:=10;
> SH:=23;
> LG:=50;
> MCD := Wilders( Typical(),Sh) - Wilders( Typical(),Lg); 
> ST := ((MCD-LLV(MCD,Cycle)) / (HHV(MCD,Cycle)-LLV(MCD,Cycle))) 
*100; 
> STC := Wilders(ST,Cycle/2);
> Cross(stc,25)
> 
> 
> Symbol Buy:
> Cycle:=10;
> SH:=23;
> LG:=50;
> MCD := Wilders( typical(),Sh) - Wilders( typical(),Lg); 
> ST := ((MCD-LLV(MCD,Cycle)) / (HHV(MCD,Cycle)-LLV(MCD,Cycle))) 
*100; 
> STC := Wilders(ST,Cycle/2);
> BB:=BarsSince(Cross(stc,25));
> BS:=BarsSince(Cross(75,stc));
> TB:=ValueWhen(1,Cross(stc,25),H);
> TS:=ValueWhen(1,Cross(75,stc),L);
> tr:=If(bb<bs,tb,ts);
> sell:=C<tr AND Ref(C,-1)> tr AND bb>bs;
> buy:=C>tr AND Ref(C,-1)< tr AND bb<bs;
> i:=Cum(buy>-1 AND sell>-1)=1;
> x:=BarsSince(i OR buy)>=BarsSince(i OR sell)=0;
> X=1 AND Ref(X,-1)=0
> 
> 
> Symbol Sell
> Cycle:=10;
> SH:=23;
> LG:=50;
> MCD := Wilders( typical(),Sh) - Wilders( typical(),Lg); 
> ST := ((MCD-LLV(MCD,Cycle)) / (HHV(MCD,Cycle)-LLV(MCD,Cycle))) 
*100; 
> STC := Wilders(ST,Cycle/2);
> BB:=BarsSince(Cross(stc,25));
> BS:=BarsSince(Cross(75,stc));
> TB:=ValueWhen(1,Cross(stc,25),H);
> TS:=ValueWhen(1,Cross(75,stc),L);
> tr:=If(bb<bs,tb,ts);
> sell:=C<tr AND Ref(C,-1)> tr AND bb>bs;
> buy:=C>tr AND Ref(C,-1)< tr AND bb<bs;
> i:=Cum(buy>-1 AND sell>-1)=1;
> x:=BarsSince(i OR buy)>=BarsSince(i OR sell)=0;
> X=0 AND Ref(X,-1)>0

the Schaffer Trigger is defined as
 
> Cycle:=10;
> SH:=23;
> LG:=50;
> MCD := Wilders( Typical(),Sh) - Wilders( Typical(),Lg); 
> ST := ((MCD-LLV(MCD,Cycle)) / (HHV(MCD,Cycle)-LLV(MCD,Cycle))) 
*100; 
> STC := Wilders(ST,Cycle/2);
> BB:=BarsSince(Cross(stc,25));
> BS:=BarsSince(Cross(75,stc));
> TB:=ValueWhen(1,Cross(stc,25),H);
> TS:=ValueWhen(1,Cross(75,stc),L);
> tr:=If(bb<bs,tb,ts);
> tr
> 

and with a little modification you get

 
> Schaffer System (modified)
> 
> 
> Highlight: 
> 
> Setup Long
> Cycle:=10;
> SH:=23;
> LG:=50;
> MCD := Wilders( Typical(),Sh) - Wilders( Typical(),Lg); 
> ST := ((MCD-LLV(MCD,Cycle)) / (HHV(MCD,Cycle)-LLV(MCD,Cycle))) 
*100; 
> STC := Wilders(ST,Cycle/2);
> Cross(stc,25)
> 
> Setup Short
> Cycle:=10;
> SH:=23;
> LG:=50;
> MCD := Wilders( Typical(),Sh) - Wilders( Typical(),Lg); 
> ST := ((MCD-LLV(MCD,Cycle)) / (HHV(MCD,Cycle)-LLV(MCD,Cycle))) 
*100; 
> STC := Wilders(ST,Cycle/2);
> Cross(75,stc)
> 
and for the Expert with the modification
> 
> Symbol: Enter Long
> Cycle:=10;
> SH:=23;
> LG:=50;
> MCD := Wilders( Typical(),Sh) - Wilders( Typical(),Lg); 
> ST := ((MCD-LLV(MCD,Cycle)) / (HHV(MCD,Cycle)-LLV(MCD,Cycle))) 
*100; 
> STC := Wilders(ST,Cycle/2);
> BB:=BarsSince(Cross(stc,25));
> BS:=BarsSince(Cross(75,stc));
> TB:=ValueWhen(1,Cross(stc,25),H);
> TS:=ValueWhen(1,Cross(75,stc),L);
> tr:=If(bb<bs,tb,ts);
> ES:=(C<tr AND Ref(C,-1)> tr AND bb>bs) OR (Cross(tr,C) AND bb>bs);
> EL:=(C>tr AND Ref(C,-1)< tr AND bb<bs) OR (Cross(C,tr) AND bb<bs);
> CL:=Cross(75,stc) OR Cross(tr,C);
> CS:=Cross(stc,25) OR Cross(C,tr);
> State:=If(Cum(1)=1,0,If(EL,1,If(ES,-1,If((CL AND PREV=1) OR (CS AND
> PREV=-1),0,PREV))));
> State=1 AND Ref(State,-1)<1 
> 
> Symbol: Enter Short
> Cycle:=10;
> SH:=23;
> LG:=50;
> MCD := Wilders( Typical(),Sh) - Wilders( Typical(),Lg); 
> ST := ((MCD-LLV(MCD,Cycle)) / (HHV(MCD,Cycle)-LLV(MCD,Cycle))) 
*100; 
> STC := Wilders(ST,Cycle/2);
> BB:=BarsSince(Cross(stc,25));
> BS:=BarsSince(Cross(75,stc));
> TB:=ValueWhen(1,Cross(stc,25),H);
> TS:=ValueWhen(1,Cross(75,stc),L);
> tr:=If(bb<bs,tb,ts);
> ES:=(C<tr AND Ref(C,-1)> tr AND bb>bs) OR (Cross(tr,C) AND bb>bs);
> EL:=(C>tr AND Ref(C,-1)< tr AND bb<bs) OR (Cross(C,tr) AND bb<bs);
> CL:=Cross(75,stc) OR Cross(tr,C);
> CS:=Cross(stc,25) OR Cross(C,tr);
> State:=If(Cum(1)=1,0,If(EL,1,If(ES,-1,If((CL AND PREV=1) OR (CS AND
> PREV=-1),0,PREV))));
> 
> State=-1 AND Ref(State,-1)>-1
> 
> 
> Symbol: Close Short
> Cycle:=10;
> SH:=23;
> LG:=50;
> ATRval:=ATR(3); 
> MCD := Wilders( Typical(),Sh) - Wilders( Typical(),Lg); 
> ST := ((MCD-LLV(MCD,Cycle)) / (HHV(MCD,Cycle)-LLV(MCD,Cycle))) 
*100; 
> STC := Wilders(ST,Cycle/2);
> BB:=BarsSince(Cross(stc,25));
> BS:=BarsSince(Cross(75,stc));
> TB:=ValueWhen(1,Cross(stc,25),H);
> TS:=ValueWhen(1,Cross(75,stc),L);
> tr:=If(bb<bs,tb,ts);
> ES:=(C<tr AND Ref(C,-1)> tr AND bb>bs) OR (Cross(tr,C) AND bb>bs);
> EL:=(C>tr AND Ref(C,-1)< tr AND bb<bs) OR (Cross(C,tr) AND bb<bs);
> CL:=Cross(75,stc) OR Cross(tr,C);
> CS:=Cross(stc,25) OR Cross(C,tr);
> State:=If(Cum(1)=1,0,If(EL,1,If(ES,-1,If((CL AND PREV=1) OR (CS AND
> PREV=-1),0,PREV))));
> 
> State=0 AND Ref(State,-1)=-1
> 
> 
> Symbol: Close Long
> Cycle:=10;
> SH:=23;
> LG:=50;
> MCD := Wilders( Typical(),Sh) - Wilders( Typical(),Lg); 
> ST := ((MCD-LLV(MCD,Cycle)) / (HHV(MCD,Cycle)-LLV(MCD,Cycle))) 
*100; 
> STC := Wilders(ST,Cycle/2);
> BB:=BarsSince(Cross(stc,25));
> BS:=BarsSince(Cross(75,stc));
> TB:=ValueWhen(1,Cross(stc,25),H);
> TS:=ValueWhen(1,Cross(75,stc),L);
> tr:=If(bb<bs,tb,ts);
> ES:=(C<tr AND Ref(C,-1)> tr AND bb>bs) OR (Cross(tr,C) AND bb>bs);
> EL:=(C>tr AND Ref(C,-1)< tr AND bb<bs) OR (Cross(C,tr) AND bb<bs);
> CL:=Cross(75,stc) OR Cross(tr,C);
> CS:=Cross(stc,25) OR Cross(C,tr);
> State:=If(Cum(1)=1,0,If(EL,1,If(ES,-1,If((CL AND PREV=1) OR (CS AND
> PREV=-1),0,PREV))));
> State=0 AND Ref(State,-1)=1

If it was this what you were looking for I am glad, else let me 
know :-) .

Martin




To unsubscribe from this group, send an email to:
Metastockusers-unsubscribe@xxxxxxxxxxx

 

Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/ 



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/zMEolB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
Metastockusers-unsubscribe@xxxxxxxxxxx

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/