Skip to main content

Schaff Trend Cycle Oscillator for Metastock

kaiji almost 16 years ago Metastock

  • Rating:
    3 / 5 (Votes 3)
  • Tags:
    oscillator, metastock

The Schaff Trend Cycle Indicator is the result of combining Slow Stochastics and the Moving Average Convergence/Divergence. The MACD is a trend indicator, yet it has lag due to its slow responsive signal line. The improved signal line gives the Schaff Trend Cycle, which acts as an early warning sign to detect trends.

MetaStock → Tools → Indicator Builder → New
Copy and paste indicator formula below.

Indicator / Formula

Copy & Paste Friendly
{ Schaff Trend Cycle Oscillator v1.0 }
{ Automatic trigger levels }
{ Also see: "MACD oscillator - Schaff Trend Cycle" }
{ http://www.metastocktools.com }
{ With thanks to Tim Straiton, www.stoploss.ch }

{ variables input }
pdsCy:=Input("Schaff cycle periods",2,252,10);
pdsSh:=Input("Short periods",1,252,10);
pdsLg:=Input("Long periods",2,2520,21);

{ Schaff Trend Cycle }
MCD:=Wilders(MP(),pdsSh)-Wilders(MP(),pdsLg);
ST:=(MCD-LLV(MCD,pdsCy))
 /(HHV(MCD,pdsCy)-LLV(MCD,pdsCy))*100;
STC:=Wilders(ST,pdsCy/2);

{ automatic trigger levels }
pk:=Ref(STC,-1)>STC AND Ref(STC,-1)>Ref(STC,-2);
pkVal:=If(pk,Ref(STC,-1),0);
pkAvg:=Cum(pkVal)/(Cum(pk)+.000001);
pkAvg:=If(pkAvg=0,100,pkAvg);
tr:=Ref(STC,-1)<STC AND Ref(STC,-1)<Ref(STC,-2);
trVal:=If(tr,Ref(STC,-1),0);
trAvg:=Cum(trVal)/(Cum(tr)+.000001);

{ plot on own window }
pkAvg;trAvg;STC

0 comments

Leave Comment

Please login here to leave a comment.