Quantcast
Channel: Traderji.com
Viewing all articles
Browse latest Browse all 10287

Measuring Cycle Periods By John Ehlers

$
0
0
i am a big fan of Mr.John Ehlers's work.though "John Ehlers is, besides his big and valuable work on a lot of indicators, also known for some statements that are pure advertisement that is not based on real results", he is leading researcher of decoding market cycles and lots of work going on nowadays based on his concepts.

"Measuring Cycle Periods",John Ehlers presents a very interesting technique of measuring dominant market cycle periods by means of multiple bandpass filtering. By utilizing an approach similar to audio equalizers, the signal (here, the price series) is fed into a set of simple second-order infinite impulse response bandpass filters.
Filters are tuned to 8,9,10,...,50 periods. The filter with the highest output represents the dominant cycle.
- traders.com march2008 traders tips

below is the afl and the screenshot of SBIN 5min chart from 24.6.13 to 28.6.13.
interesting!the afl spotted the top&bottom several times very accurately!



PHP Code:

_SECTION_BEGIN("cycle121");

SetChartBkColor(ParamColor("Panel color ",colorOrange));


PI 3.1415926;
Data = (H+L)/2;
// detrending ( high-pass filter )
HFPeriods Param("HP filter cutoff"4020100 );
alpha1 = ( 1-sin(2*pi/HFPeriods) ) / cospi HFPeriods );
HP AMA2Data RefData, -), 0.5 * ( alpha1 ), alpha1 );
// 6-tap low-pass FIR filter
SmoothHP  = ( HP RefHP, -) + RefHP, -) +
   
RefHP, -) + RefHP, -) + RefHP, -) )/12;
SmoothHPDiff SmoothHP RefSmoothHP, -);
BarIndex();
delta = -0.015 0.5;
delta Maxdelta0.15 );
Q  0;
Real 0;
Imag 0;
Ampl 0;
DB =  0;
SmoothHP;
MaxAmpl 0;
for( 
8<= 50N++ )
{
  
beta cosPI );
  
= ( / ( PI ) ) * SmoothHPDiff;
 
  for( 
bar 8bar BarCountbar++ )
  {
     
gamma cosPI deltabar ] / );
     
alpha gamma sqrtgamma );
 
     
Realbar ] = 0.5 * ( alpha ) * ( Ibar ] - Ibar ] ) +
                   
beta * ( alpha ) * Realbar ] -
                   
alpha Realbar ];
     
Imagbar ] = 0.5 * ( 1alpha ) * ( Qbar ] - Qbar ] ) +
                
beta * ( alpha ) * Imagbar ] -
                
alpha Imagbar ];
   }
   
Ampl Real Imag 2;
   
MaxAmpl MaxMaxAmplAmpl );
   
VarSet("Ampl"+NAmpl );
}
TunedFilterDisplay ParamToggle("Dom Cycle Tuned Filter""No|Yes" );
// Plot Heat Map ( Spectrogram )
// and find dominant cycle
DcNum DcDenom 0;
for( 
8<= 50N++ )
{
   
Ampl VarGet("Ampl"+N);
   
db  Nz( -10 log100.01 / ( 0.99 Ampl MaxAmpl ) ) );
 
   
db Mindb20 ) ;
   
Red IIfdb <= 10255255 * ( db/10 ) );
   
Green IIfdb <= 10255 * ( db/10 ), );
   if( 
NOT TunedFilterDisplay  )
      
PlotOHLCNNN-1N-1""ColorRGBRedGreen),
                                    
styleCloud styleNoLabel );
   
DcNum DcNum + (db ) * * ( 20 db );
   
DcDenom DcDenom + ( db ) * ( 20 db );
}
DC DcNum DcDenom;
if( 
ParamToggle("Show Dom. Cycle?""No|Yes" ) )
{
  
DomCycle MedianDC10 );
  
PlotDomCycle"Dominant Cycle"colorBlue );
}
if( 
TunedFilterDisplay )
{
   
DomCycle MedianDC10 );
   
DomCycle MaxDomCycle);
   
Value 0;
   for( 
bar 10bar BarCountbar++ )
   {
     
beta cosPI domCyclebar ] );
     
gamma cosPI deltabar ] / DomCyclebar ] );
     
alpha gamma sqrtgamma );
     
Valuebar ] = 0.5 * ( alpha ) * SmoothHPDiffbar ] +
           
beta * ( alpha ) * Valuebar ] -
           
alpha Valuebar ];
   }
   
Value2 = ( domCycle / ( PI ) ) * ( Value RefValue, -) );
   
PlotValue"Sine"colorBlue );
   
PlotValue2"Cosine"colorWhite );
}
GraphZOrder 1;
_SECTION_END(); 


Viewing all articles
Browse latest Browse all 10287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>