Announcement

Collapse
No announcement yet.

Looking for Schaaf Trend Cycle

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Looking for Schaaf Trend Cycle

    I am looking for the Schaff Trend Cycle indicator.

  • #2
    Did a quick look and found nothing here at eSignalCentral.

    Did find some information with this search...
    Click here.

    Upon further reading this sounds like a good idea for someone with EFS experience to play with! Research looks interesting. Thanks for asking about this, am now interested in learning more myself. I like this link... click here.
    Marc

    Comment


    • #3
      Here is a formula I found at;



      MetaStock -> Tools -> Indicator Builder -> New
      Copy and paste indicator formulae below.


      =============================
      Schaff Trend Cycle Oscillator
      =============================
      ---8<------------------------

      { Schaff Trend Cycle Oscillator v1.0 }
      { Automatic trigger levels }
      { Also see:
      "MACD oscillator - Schaff Trend Cycle" }
      { [email protected] }
      { 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:=***(pkVal)/(***(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:=***(trVal)/(***(tr)+.000001);

      { plot on own window }
      pkAvg;trAvg;STC

      ---8<------------------------


      =============================
      Schaff Trend Cycle Indicator
      =============================
      ---8<------------------------

      { Schaff Trend Cycle Indicator v1.0 }
      { Automatic trigger levels }
      { Also see:
      "MACD oscillator - Schaff Trend Cycle" }
      { [email protected] }
      { With thanks to Tim Straiton, www.stoploss.ch }

      { variables input }
      buffer:=Input("Long/Short buffer zone %",
      0,100,0)/100;
      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);

      { 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:=***(pkVal)/(***(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:=***(trVal)/(***(tr)+.000001);

      { STC crossover signals }
      In:=Cross(pkAvg,STC);
      Out:=Cross(STC,trAvg);
      InInit:=***(In)=1;
      Init:=***(In+Out>-1)=1;
      flag:=BarsSince(Init OR In)
      < BarsSince(Init OR Out)+InInit;
      signals:=(InInit AND Alert(InInit=0,2)
      OR flag AND Alert(flag=0,2))
      +-(flag=0 AND Alert(flag,2));

      { trend support/resistance levels }
      STCI:=If(flag,ValueWhen(1,signals,L*(1-buffer)),
      ValueWhen(1,signals=-1 OR Init,H*(1+buffer)));

      { alternative STC crossover signals method}
      {bb:=BarsSince(Cross(STC,trAvg));
      bs:=BarsSince(Cross(pkAvg,STC));
      tb:=ValueWhen(1,Cross(STC,trAvg),H*(1+buffer));
      ts:=ValueWhen(1,Cross(pkAvg,STC),L*(1-buffer));
      STCI:=If(bb<bs,tb,ts);}

      { plot on price chart }
      STCI

      ---8<------------------------


      Comment


      • #4
        Here is another site with EFS code;

        Comment


        • #5
          Thanks for the code, but how can I use it in Esignal? I assume that someone would have to re-code it for Esignal. Could someone do it please, since this indicator can be pretty useful.
          Thanks

          Comment


          • #6
            I converted the Metastock Schaff Trend Cycle Oscillator code to EFS and placed it in the File Share here:

            http://share.esignal.com/groupconten...us&groupid=114

            Chris

            Comment


            • #7
              You are truely gifted

              Thanks

              Comment

              Working...
              X