Advertisement
JoshuaB

Scaff Trend Cycle in TradeStation EasyLanguage

Jul 2nd, 2013
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. {*******************************************************************
  2. Description : This Indicator plots the Schaff Trend Cycle
  3. Provided By : FX-Strategy, Inc. (c) Copyright 1999
  4. ********************************************************************}
  5.  
  6. Inputs: TCLen(10), MA1(23), MA2(50);
  7. plot1(_SchaffTC(TCLen,MA1,MA2),"Schaff_TLC");
  8. plot2(25);
  9. plot3(75);
  10.  
  11. {*******************************************************************
  12. Description : This is the Schaff Trend Cycle function
  13. Provided By : FX-Strategy.com (c) Copyright 1999
  14. ********************************************************************}
  15.  
  16. Inputs: TCLen(NumericSimple), MA1(NumericSimple), MA2(NumericSimple);
  17. Variables: XMac(0), Frac1(0), PF(0), PFF(0), Frac2(0), Factor(.5);
  18.  
  19. {Calculate a MACD Line}
  20. XMac = MACD(c,MA1,MA2) ;
  21.  
  22. {1st Stochastic: Calculate Stochastic of a MACD}
  23. Value1 = Lowest(XMac, TCLen);
  24. Value2 = Highest(XMac, TCLen) - Value1;
  25.  
  26. {%FastK of MACD}
  27. Frac1 = IFF(Value2 > 0, ((XMac - Value1) / Value2) * 100, Frac1[1]);
  28.  
  29. {Smoothed calculation for %FastD of MACD}
  30. PF = IFF(CurrentBar<=1, Frac1, PF[1] + (Factor * (Frac1 - PF[1])));
  31.  
  32. {2nd Stochastic: Calculate Stochastic of Smoothed Percent FastD, ‘PF’, above.}
  33. Value3 = Lowest(PF, TCLen);
  34. Value4 = Highest(PF, TCLen) - Value3;
  35.  
  36. {%FastK of PF}
  37. Frac2 = IFF(Value4 > 0, ((PF - Value3) / Value4) * 100, Frac2[1]);
  38.  
  39. {Smoothed calculation for %FastD of PF}
  40. PFF = IFF(CurrentBar<=1, Frac2, PFF[1] + (Factor * (Frac2 - PFF[1])));
  41.  
  42. {The STC function is the %FastD of PF}
  43. _SchaffTC= PFF;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement