거래 로봇을 무료로 다운로드 하는 법을 시청해보세요
당사를 Facebook에서 찾아주십시오!
당사 팬 페이지에 가입하십시오
스크립트가 흥미로우신가요?
그렇다면 링크 to it -
하셔서 다른 이들이 평가할 수 있도록 해보세요
스크립트가 마음에 드시나요? MetaTrader 5 터미널에서 시도해보십시오
지표

Cycle Period - MetaTrader 5용 지표

게시자:
Nikolay Kositsin
조회수:
13038
평가:
(18)
게시됨:
2011.11.22 19:30
업데이트됨:
2018.05.31 11:46
이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동

Real author:

Witold Wozniak

This indicator is designed for measurement of a financial asset price change periodicity.

The indicator stores in its indicator buffer the current market cycle values, which can never be stable for obvious reasons. This indicator is created to be used with oscillators to provide their adaptation to constantly changing market cycles and their transformation to adaptive ones.

The indicator is inspired by John Ehlers' article "Using The Fisher Transform" published in November 2002 in the "Technical Analysis Of Stock & Commodities" magazine.  

Cycle Period

The CyclePeriod indicator handle variable must be declared on the global level to let the indicator be used in another indicator's code (for example, in RVI oscillator):

//---- declaration of integer variables for the indicators handles
int CP_Handle;

Then, the CyclePeriod indicator handle must be received in the RVI indicator initialization block:

//---- getting the CyclePeriod indicator handle
   CP_Handle=iCustom(NULL,0,"CyclePeriod",Alpha);
   if(CP_Handle==INVALID_HANDLE)
     {
      Print(" Failed to get the CyclePeriod indicator handle");
      return(1);
     }

Now, we have the new Alpha variable that is the input parameter of the used indicator and the period averaging ratio. This variable must be transformed to the developed indicator input variable.

//+----------------------------------------------+
//| Indicator input parameters                   |
//+----------------------------------------------+
input double Alpha=0.07; // Indicator smoothing ratio 

The previous Length input variable must be removed from the list of the input parameters transforming it to the local variable inside the OnCalculate() function.

The size of the arrays used for the indicator smoothing is fixed by the Length parameter value:

//---- Memory distribution for the variables arrays  
   ArrayResize(Count,Length);
   ArrayResize(Value1,Length);
   ArrayResize(Value2,Length);

The value of this parameter is changing now. Therefore, it is better to set the sizes of these arrays to be not less than the assumed high value of this variable.

While analyzing the indicator charts, we can see that this value does not exceed 100. Therefore, the arrays sizes will have the same value:

//---- Memory distribution for the variables arrays  
   ArrayResize(Count,MAXPERIOD);
   ArrayResize(Value1,MAXPERIOD);
   ArrayResize(Value2,MAXPERIOD);

And further on, period values for the current bar in the OnCalculate() block must be taken from the CyclePeriod custom indicator buffer to let them be used instead of the value of the Length former input parameter.

//---- main indicator calculation loop
   for(bar=first; bar<rates_total && !IsStopped(); bar++)
     {
      //---- copy newly appeared data into the array
      if(CopyBuffer(CP_Handle,0,rates_total-1-bar,4,period)<=0) return(RESET);

      Length=int(MathFloor((4.0*period[0]+3.0*period[1]+2.0*period[2]+period[3])/20.0));
      if(bar<Length) Length=bar; // cutting the smoothing down to the real number of bars

In this case four last values are taken from the CyclePeriod indicator buffer and their linearly weighted smoothing is performed, after which the gained value is used as a Length smoothing period. And finally, the line at the end of the indicator code must be altered:

      if(bar<rates_total-1) Recount_ArrayZeroPos(Count,MAXPERIOD);

As a result, we have received Adaptive RVI oscillator:

RVI and Adaptive RVI indicators

MetaQuotes Ltd에서 러시아어로 번역함.
원본 코드: https://www.mql5.com/ru/code/562

Stochastic Cyber Cycle Stochastic Cyber Cycle

Adaptive Stochastic oscillator.

Daily Range Projections Full Daily Range Projections Full

Forecasting the next day candlestick changing range for all bars of the current chart.

XXDPO XXDPO

Detrended Price Oscillator (DPO) shows the market overbought/oversold states and also can be used for getting buy/sell signals.

Adaptive CG Oscillator Adaptive CG Oscillator

Adaptive CG Oscillator is a CG Oscillator that can adapt to constantly changing market cycles of a real financial asset.