NexusFi: Find Your Edge


Home Menu

 





Schaff


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one kiasom with 2 posts (8 thanks)
    2. looks_two cory with 1 posts (3 thanks)
    3. looks_3 Trader.Jon with 1 posts (0 thanks)
    4. looks_4 jaikumarm with 1 posts (3 thanks)
      Best Posters
    1. looks_one kiasom with 4 thanks per post
    2. looks_two cory with 3 thanks per post
    3. looks_3 jaikumarm with 3 thanks per post
    4. looks_4 randyjb with 2 thanks per post
    1. trending_up 10,582 views
    2. thumb_up 16 thanks given
    3. group 9 followers
    1. forum 9 posts
    2. attach_file 2 attachments




 
Search this Thread

Schaff

  #1 (permalink)
 kiasom 
Stockholm
 
Experience: Intermediate
Platform: MC
Trading: fx
Posts: 16 since Apr 2010
Thanks Given: 139
Thanks Received: 23

Found the Schaff Trend Cycle in EasyLanguage, as released by Mr. Schaff himself.
It's a very fast reacting indicator, which might be valuable in a MTF system.


From the documentation:
"What is the STC?
Schaff Trend Cycle (STC) is a popular indicator commonly used to identify or confirm price direction and market turning points. It was created by Doug Schaff and is based on the assumption that trends accelerate and decelerate in a cyclical pattern that can reflect the dominant price cycle of any asset in any timeframe.
.
Schaff created the STC after trying to resolve the discrepancies that he observed between two widely used methods of determining trend:
􀂃 Moving Average Convergence and Divergence (MACD), the movement of two moving averages away from and towards each other.
􀂃 Price Cycles, the direction of the dominant price cycle as shown by various Smoothed Stochastics.
The STC is created by running a MACD Line (the difference between two exponential moving averages) through a Double Smoothed Stochastic algorithm. The resulting oscillator combines the benefits of trend and momentum indicators. In trending markets it moves between 0 and 100, rising when an uptrend is accelerating and falling when a downtrend is accelerating.
In sideways markets the STC is used as a range-trading indicator and can be interpreted similarly to standard oscillators. That is, the STC can signal oversold conditions when it turns up from below the 25-Line, and overbought conditions when it turns down from above the 75-Line.
Why is the STC important?
The STC has several benefits compared to its component indicators. It produces less whipsaw and fewer false signals than the MACD or Price Cycle oscillators. By combining the two, Schaff created an indicator that is more accurate and more adaptive than either original indicator is by itself.
The STC usually turns up or down earlier than the MACD crossover, highlighting prospective trend changes sooner. In sideways markets, the STC generally travels in a clear path from under 25 to over 75, making it easier to interpret than the MACD which has no maximum or minimum values.
The STC is an improvement compared to Cycle Oscillators which can give out wrong signals when the dominant cycle changes in length. In a strongly uptrending market, for instance, a 20-bar Cycle can be absorbed and practically disappear into the longer rise to the top of a 40-bar Cycle. At those times a Cycle Oscillator set to the 20-bar cycle can give false signals, turning down in an accelerating bull market or rising into a rapidly declining bear market.
The STC adapts when the dominant cycle lengthens or shortens, and so often it identifies cycle tops and bottoms more accurately than fixed or multiple-length oscillators. In strong rising markets the STC moves up to its ceiling of 100 and can stay there, reflecting an extended bullish move, until the trend slows and prices begin a sideways or downwards retracement after the longer cycle peaks. Likewise, in strong bear markets the STC usually falls quickly to 0 and can remain there until trend slows and prices drop, confirming that a longer price cycle low has occurred."

There is the indicator:
 
Code
{*******************************************************************
Description : This Indicator plots the Schaff Trend Cycle
Provided By : FX-Strategy, Inc. (c) Copyright 1999
********************************************************************}
Inputs: TCLen(10), MA1(23), MA2(50);

plot1(_SchaffTC(TCLen,MA1,MA2),"Schaff_TLC");
plot2(25);
plot3(75);
And the function:
 
Code
{*******************************************************************
Description : This is the Schaff Trend Cycle function
Provided By : FX-Strategy.com (c) Copyright 1999
********************************************************************}

Inputs: TCLen(NumericSimple), MA1(NumericSimple), MA2(NumericSimple);
Variables: XMac(0), Frac1(0), PF(0), PFF(0), Frac2(0), Factor(.5);

{Calculate a MACD Line}
XMac = MACD(c,MA1,MA2) ;

{1st Stochastic: Calculate Stochastic of a MACD}
Value1 = Lowest(XMac, TCLen);
Value2 = Highest(XMac, TCLen) - Value1;

{%FastK of MACD}
Frac1 = IFF(Value2 > 0, ((XMac - Value1) / Value2) * 100, Frac1[1]);

{Smoothed calculation for %FastD of MACD}
PF = IFF(CurrentBar<=1, Frac1, PF[1] + (Factor * (Frac1 - PF[1])));

{2nd Stochastic: Calculate Stochastic of Smoothed Percent FastD, ?PF?, above.}
Value3 = Lowest(PF, TCLen);
Value4 = Highest(PF, TCLen) - Value3;

{%FastK of PF}
Frac2 = IFF(Value4 > 0, ((PF - Value3) / Value4) * 100, Frac2[1]);

{Smoothed calculation for %FastD of PF}
PFF = IFF(CurrentBar<=1, Frac2, PFF[1] + (Factor * (Frac2 - PFF[1])));

{The STC function is the %FastD of PF}
_SchaffTC= PFF;

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
What broker to use for trading palladium futures
Commodities
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
How to apply profiles
Traders Hideout
Cheap historycal L1 data for stocks
Stocks and ETFs
 
  #3 (permalink)
 kiasom 
Stockholm
 
Experience: Intermediate
Platform: MC
Trading: fx
Posts: 16 since Apr 2010
Thanks Given: 139
Thanks Received: 23


Here is the documentation document. With some good explanations.

Attached Thumbnails
Schaff-schaff-indy.pdf  
Started this thread Reply With Quote
Thanked by:
  #4 (permalink)
 
Trader.Jon's Avatar
 Trader.Jon 
Near the BEuTiFULL Horse Shoe
 
Experience: Beginner
Platform: NinjaTrader
Broker: MBTrading Dukascopy ZenFire
Trading: $EURUSD when it is trending
Posts: 473 since Jul 2009
Thanks Given: 401
Thanks Received: 184

Has anyone started code to have this in NT ??

Reply With Quote
  #5 (permalink)
 
cory's Avatar
 cory 
virginia
 
Experience: Intermediate
Platform: ninja
Trading: NQ
Posts: 6,098 since Jun 2009
Thanks Given: 877
Thanks Received: 8,090

bottom of page
Schaff Trend Cycle Metatrader Indicator | Great Trading Systems

Reply With Quote
Thanked by:
  #6 (permalink)
 
randyjb's Avatar
 randyjb 
Southern California
 
Experience: Intermediate
Platform: NinjaTrader
Trading: TF
Posts: 71 since Jun 2009
Thanks Given: 497
Thanks Received: 34

SchaffTrendCycle.zipHere it is for NT ..6.5

Reply With Quote
Thanked by:
  #7 (permalink)
 neilzep 
us
 
Posts: 44 since Dec 2010

anybody got the version with the arrows of buy/sell? would appreciate it.

Reply With Quote
  #8 (permalink)
 jaikumarm 
Palo Alto, CA
 
Experience: Intermediate
Platform: Python
Broker: IB/IQfeed
Trading: E6, ES
Posts: 13 since Apr 2010
Thanks Given: 184
Thanks Received: 21

Okay here is the code to convert this Schaff Indicator to a Signal.

This is my first attempt at this, so if this is wrong, or needs improvement do let me know.

 
Code
{*************************************************  ******************
Description : This is the Schaff Trend Cycle function
Provided By : FX-Strategy.com (c) Copyright 1999
**************************************************  ******************}

[IntrabarOrderGeneration = false]

Inputs: Price( Close), TCLen(10), MA1(145), MA2(240);
Variables: XMac(0), Frac1(0), PF(0), PFF(0), Frac2(0), Factor(.5);

{Calculate a MACD Line}
XMac = MACD(c,MA1,MA2) ;

{1st Stochastic: Calculate Stochastic of a MACD}
Value1 = Lowest(XMac, TCLen);
Value2 = Highest(XMac, TCLen) - Value1;

{%FastK of MACD}
Frac1 = IFF(Value2 > 0, ((XMac - Value1) / Value2) * 100, Frac1[1]);

{Smoothed calculation for %FastD of MACD}
PF = IFF(CurrentBar<=1, Frac1, PF[1] + (Factor * (Frac1 - PF[1])));

{2nd Stochastic: Calculate Stochastic of Smoothed Percent FastD, ?PF?, above.}
Value3 = Lowest(PF, TCLen);
Value4 = Highest(PF, TCLen) - Value3;

{%FastK of PF}
Frac2 = IFF(Value4 > 0, ((PF - Value3) / Value4) * 100, Frac2[1]);

{Smoothed calculation for %FastD of PF}
PFF = IFF(CurrentBar<=1, Frac2, PFF[1] + (Factor * (Frac2 - PFF[1])));

{******************Buy and Sell Signals******************}

If PFF crosses above 99 then 
begin
	buy ("SchaffFC Long") this bar at close;
end
else if PFF crosses below 1 then 
begin
	sellshort ("SchaffFC Short") this bar at close;
end
else if PFF crosses below 99 then 
begin
	sell ("SchaffFC Sell") this bar at close;
end
else if PFF crosses above 1 then 
begin
	buytocover ("SchaffFC Buy") this bar at close;
end;

Reply With Quote
Thanked by:
  #9 (permalink)
slythic
Miami, FL
 
Posts: 13 since Apr 2020
Thanks Given: 3
Thanks Received: 1

Many thanks for posting!

Reply With Quote
  #10 (permalink)
Shaban
Turin + Italy
 
Posts: 194 since Feb 2020
Thanks Given: 24
Thanks Received: 129


This Trading System was published here on 19 September 2013:

https://www.enricomalverti.com/2013/09/lo-schaff-indicator/

P.S.: when copying a T.S. it would be correct to quote the source

Reply With Quote




Last Updated on April 16, 2020


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts