# Request: Shaff Trend Cycle

Hi, I saw Shaff Trend Cycle here https://www.mql5.com/en/forum

(the last indicator in the picture)

Can someone send me a link for it to download?

One more question-how to make 2 indicators in 1 window, f.e. Stoch(14,5,3) and Stoch(5,5,3) to be in 1 indicator?

Thanks

evgeni1980:
Hi, I saw Shaff Trend Cycle here https://www.mql5.com/en/forum

(the last indicator in the picture)

Can someone send me a link for it to download?

One more question-how to make 2 indicators in 1 window, f.e. Stoch(14,5,3) and Stoch(5,5,3) to be in 1 indicator?

Thanks

- Something interesting please post here;

ok, thanks, I found it, but can you (or someone else) give me an idea how to input sound alarm to be played when the indicator goes above 1% line and when goes below the 99% line (or when is between 1-10% line and when is between 99-90% line)

This is the sorce:

This is Shaff Trend Cycle:

#property indicator_separate_window

#property indicator_minimum -10

#property indicator_maximum 110

#property indicator_buffers 1

#property indicator_color1 DarkOrchid

//---- input parameters

extern int MAShort=23;

extern int MALong=50;

extern double Cycle=10;

extern int CountBars=300;

//---- buffers

double MA[];

double ST[];

//+------------------------------------------------------------------+

//| Custom indicator initialization function |

//+------------------------------------------------------------------+

int init()

{

// string short_name;

//---- indicator line

IndicatorBuffers(2);

SetIndexBuffer(0, MA);

SetIndexBuffer(1, ST);

SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2,DarkOrchid);

//----

//----

return(0);

}

//+------------------------------------------------------------------+

//| Schaff Trend Cycle |

//+------------------------------------------------------------------+

int start()

{

SetIndexDrawBegin(0,Bars-CountBars+MALong+MAShort+1);

int shift,u,counted_bars=IndicatorCounted();

double MCD, LLV, HHV, MA_Short, MA_Long, sum ,prev, smconst;

int n, i, s;

bool check_begin=false, check_begin_MA=false;

double MCD_Arr[100];

if(Bars<=MALong) return(0);

if (CountBars==0) CountBars=Bars;

//---- initial zero

if(counted_bars<MALong+MAShort)

{

for(i=1;i<=MALong;i++) MA=0.0;

for(i=1;i<=MALong;i++) ST=0.0;

}

//----

shift=CountBars-MALong-1;

// if(counted_bars>=MALong) shift=Bars-counted_bars-1;

check_begin = false;

check_begin_MA = false;

n = 1;

s = 1;

smconst = 2 / (1 + Cycle/2);

while(shift>=0)

{

MA_Short = iMA(NULL,0,MAShort,0, MODE_EMA, PRICE_TYPICAL, shift);

MA_Long = iMA(NULL,0,MALong,0, MODE_EMA, PRICE_TYPICAL, shift);

MCD_Arr[n] = MA_Short - MA_Long;

MCD = MA_Short - MA_Long;

if (n >= Cycle)

{

n = 1; check_begin = true; } else {n = n + 1;}

if (check_begin)

{

for (i = 1; i<=Cycle; i++)

{

if (i == 1) {LLV = MCD_Arr;}

else {

if (LLV > MCD_Arr) LLV = MCD_Arr;

}

if (i == 1) {HHV = MCD_Arr;}

else {

if (HHV < MCD_Arr) HHV = MCD_Arr;

}

}

ST[shift] = ((MCD - LLV)/(HHV - LLV))*100 + 0.01;

s = s + 1;

if (s >= (Cycle)/2)

{

s = 1;

check_begin_MA = true;

}

} else {ST[shift] = 0;}

if (check_begin_MA) {

prev = MA[shift + 1];

MA[shift] = smconst * (ST[shift] - prev) + prev; }

shift--;

}

return(0);

}

You may check the threads:

It is very easy to use it with this Codersguru tool.

i have a simple request, please!!

i have a request to all great coders, this is the entire article (i copy paste):

"The Schaff Trend Cycle Indicator is the product of combining Slow Stochastics and the Moving Average Convergence/Divergence (MACD). The MACD has a reputation to be a trend indicator, yet it has an equal reputation to be lagging due to its slow responsive signal line. The improved signal line gives the STC its relevance as an early warning sign to detect currency trends.

How the STC Works

The STC detects up and down trends long before the MACD. It does this by using the same exponential moving averages (EMAs), but adds a cycle component to factor currency cycle trends. Since currency cycle trends move based on a certain amount of days, this is factored into the equation of the STC Indicator to give more accuracy and reliability than the MACD.

Since the MACD is nothing more than a series of EMAs with a signal line, the STC has improved on the MACD. MACD has a 12- and 26-period EMA with a nine-period signal line. STC Indicator improved on this by incorporating a 23- and 50-period EMA with a cycle component used as the 10-period signal line. Since we can factor cycle trends based on X amount of days, we can then know how far and how long a trend lasts in terms of potential pips to earn.

In terms of indicators both old and new, the STC Indicator is quite original in its conception. Never before has an indicator been developed using a cycle component. Most use some form of moving average, particularly EMAs, as a base because it's easier to calculate and it focuses on recent prices rather than a simple moving average's long data set of closing prices.

STC Development

The STC Indicator was developed primarily for fast markets, particularly currency markets, yet it can be employed in any market.The trend in the modern day is to develop more accurate, reliable and early warning signal detectors to follow prices more accurately using the old models. The invention of the computer made it able to capture speed, accuracy and reliability of prices more uniformly, because the computer eliminated the need to calculate long equations using pen and paper. So, any new modern indicator will always have a higher reliability factor when a signal is generated.

However, as reliable as the STC Indicator may be, never will an indicator be perfect. The reliability factor may be higher but slight problems exist because of the STC's ability to stay in overbought and oversold markets for extended periods. For this reason, the STC Indicator should be used for its intended purpose: to follow the signal line up and down and take profits when the signal line hits bottom or top. Eventually another signal will generate.

Indicator Issues

Notice how many times the STC line resulted in a straight line to signal an overbought or oversold market. One certain aspect is that oversold markets will eventually become overbought and overbought markets will become oversold, especially when it comes to the currency cycle aspects of this indicator. Yet that is not a signal generator. Overbought or oversold markets represented by a straight line can in many instances still represent 200 points on the upside, as it did at the overbought mark at 14:00 in the middle of the chart. This is the small problem with the STC Indicator. The recommendation is to wait for the signal before jumping in.

One can increase the cycle count signal line from 10 and adjust upwards to fit the exact market. This would represent smaller market turns and a more accurate reading. Caution is advised not to increase the cycle count higher than 40, since that is the maximum currency count. One can also adjust downward to generate many market turns, but they may not be accurate signals. For longer time framed charts such as the weekly, it is recommended to adjust the EMAs to 12 and 26 or 7 and 13, and allow the same amount of cycle counts at 20 as the signal line. For shorter time frames, such as the 10-minute chart, increase the EMAs to 115 and 240, and allow the same cycle count. A personal recommendation is to allow the indicator to work as intended with the recommended settings, especially when it comes to cycle counts. Better to adjust the EMAs rather than the cycle count trigger line if one has to adjust at all.

Conclusion

The inventor of the STC Indicator allowed the full knowledge of formulas and codes to be released in 2008, so the trading public is now becoming aware of its use as an early warning trend signal. I have personally used and profited from its use on many occasions, and I have personally used the recommended settings. The interesting aspect is that this indicator is forward-looking, and is considered a leading indicator. This means false signals are very rare if ever generated. Plus, signals are generated much faster than the old indicators, such as MACD. For another recommended indicator that works as intended, this is a good one."

[ i request to modify this indicator (STC_Plot_dcec.mq4 and ex4), using this three custom indicators using their calculation and coding like (MACD_colored_mladen.mq4 and ex4 using Zerolag MACD calculation), (ZeroLag Stochs_true.mq4 and ex4) and using (NONLAGv3.mq4 and ex4) for incorporating to the STC.

Please do my request, its very helpful to my trading, Thanks to the admin!! and other forumers has a great contribution!!

Sorry for my bad english

Files:
myrequest.zip  27 kb
Reason: