The Instantaneous Cycle Period Measurement

The Instantaneous Cycle Period Measurement was authored by John Ehlers; it is built upon his Hilbert Transform Indicator. The user may change the input (midpoint) and Hilbert period length. This indicator’s definition is further expressed in the condensed code given in the calculation below.

Click here for more information on Ehler’s indicators.

Click here for more information on the Hilbert Transform Indicator

InstantaneousCyclePeriodMeasurment

How To Trade Using the Instantaneous Cycle Period Measurment

The Instantaneous Cycle Period Measurment may be used in conjuction with other indicators. No trading signals are calculated in this study.

How To Access in MotiveWave

Go to the top menu, choose Study>John Ehlers>Instantaneous Cycle Period Measurment

or go to the top menu, choose Add Study, start typing in this study name until you see it appear in the list, click on the study name, click OK.

Important Disclaimer: The information provided on this page is strictly for informational purposes and is not to be construed as advice or solicitation to buy or sell any security. Please see our Risk Disclosure and Performance Disclaimer Statement.

Calculation

//input = price, user defined, default is midpoint price
//Hilbert period = user defined, default is 7
//quad = quadrature = imaginary part of complex number
//inPhase = real part of complex number
//index = current bar number

iMult = .635;
qMult = .338;

priorPrice = price[index-period];
//v1 = detrend price
v1 = price - priorPrice;

v2 = v1[index-2];      
v4 = v1[index-4];      

inPhase3 = inPhase[index-3];      
quad2 = quad[index-2];      

//Hilbert transform complex number components, inPhase (real part), quad (imaginary part)
inPhase = 1.25 * (v4 - (iMult*v2) + (iMult*inPhase3));
quad = v2 - (qMult*v1) + (qMult*quad2);

prevInPhase = inPhase[index-1];
prevQuad = quad[index-1];
if (Math.abs(inPhase + prevInPhase) moreThan 0) 
  phase = Math.atan(Math.abs((quad+prevQuad)/(inPhase+prevInPhase))); 
endif
if (inPhase lessThan 0 AND quad moreThan 0) phase = 180 - phase;
if (inPhase lessThan 0 AND quad lessThan 0) phase = 180 + phase;
if (inPhase moreThan 0 AND quad lessThan 0) phase = 360 - phase;
      
prevPhase = phase[index-1];
deltaPhase = prevPhase - phase;
      
if (prevPhase lessThan 90 AND phase moreThan 270) deltaPhase = 360 + prevPhase - phase;
if (deltaPhase lessThan 1) deltaPhase = 1;
if (deltaPhase moreThan 60) deltaPhase = 60;
      
instPeriod = 0;
for (int count = 0; count lessThan 51; count++)
    priorDP = deltaPhase[index-count];
    v4 = v4 + priorDP;
    if (v4 moreThan 360 AND instPeriod == 0) instPeriod = count;
endFor
   
if (instPeriod == 0) 
    instPeriod = instPeriod[index-1];
endIf
prevPeriod = period[index-1];
period = (.25 * instPeriod) + (.75 * prevPeriod);
Plot: period;