.

Most Accurate Ergodic Oscillator - Amibroker AFL Code

Click Image To Enlarge. Please Rate And Comment.

Most Accurate Ergodic Oscillator

Len_r = Param( "TSI period 'r':", 32 , 1 , 100 );
Len_s = Param( "TSI period 's':", 5 , 1 , 100 );
Len_5 = 5 ;

Mtm = C - Ref ( C, -1 );
AbsMtm = abs ( Mtm );

//===============================
Num_T = EMA ( EMA ( Mtm, Len_r ), Len_s );
Den_T = EMA ( EMA ( AbsMtm, Len_r ), Len_s );
TSI = 100 * Nz ( Num_T / Den_T );

//===============================
Num_E = EMA ( EMA ( Mtm, Len_r ), Len_5 );
Den_E = EMA ( EMA ( AbsMtm, Len_r ), Len_5 );

Ergodic = 100 * Nz ( Num_E / Den_E );
SigLin = EMA ( Ergodic, Len_5 );

//===============================
GraphXSpace = 2 ;
ErgCol = colorBlue;
Plot( Ergodic, "Ergodic Osc.", ErgCol, styleLine);
Plot( SigLin, "", colorDarkYellow, styleLine );

//===============================
Hist = Ergodic - SigLin;
HistCol = IIf ( Hist>= 0, colorGreen, colorRed );
Plot(Hist, "Histogram", HistCol, styleHistogram | styleThick | styleNoLabel);

//===============================
Title = EncodeColor( colorDarkBlue ) + FullName() + " [" + Name() + "]" +
EncodeColor( colorDarkGrey ) + WriteVal( DateTime(), formatDateTime ) + "\n" +
EncodeColor( colorBrown ) + "Blau: The Ergodic Oscillator, EO(" +
EncodeColor( ErgCol ) + "r" + EncodeColor(colorBrown ) + ",5,5 ) " +
EncodeColor( ErgCol ) + "r_Pds: " + Len_r +
EncodeColor( colorGrey40 ) + " (Adjustable).";
Previous Post Next Post