Skip to main content

Aggregate M Indicator for Amibroker (AFL)

BBChopper about 15 years ago Amibroker (AFL)

  • Rating:
    5 / 5 (Votes 2)
  • Tags:
    oscillator, amibroker

David Varadi’s Aggregate M Indicator as discussed here: http://cssanalytics.wordpress.com/2009/11/05/trend-or-mean-reversion-why-make-a-choice-the-simple-aggregate-m-indicator/

Screenshots

Indicator / Formula

Copy & Paste Friendly
//PercentRankHLC Function
//As Coded by Ramon Cummins
function PercentRankHLC(Data1, Data2, Data3, Periods) {
	Count = 0;
	for (i = 0; i < Periods + 1; i++) {
		Count = Count + IIf(Ref(Data3, 0) > Ref(Data1, -i), 1, 0);
		Count = Count + IIf(Ref(Data3, 0) > Ref(Data2, -i), 1, 0);
		Count = Count + IIf(Ref(Data3, 0) > Ref(Data3, -i), 1, 0);
	}
	return 100 * Count / (Periods*3-1);
}

//David Varadi's Aggregate M Indicator as discussed here:
//http://cssanalytics.wordpress.com/2009/11/05/trend-or-mean-reversion-why-make-a-choice-the-simple-aggregate-m-indicator/
rank_Long = PercentRankHLC( H, L, C, 252 );
rank_Short = 1 - PercentRankHLC( H, L, C, 10 );
Value = ( rank_Long + rank_Short ) / 2;
AggM = ( Ref(value, -1) * 0.4 ) + ( value * 0.6 );

Plot(AggM, "AggM", colorBlack);

Plot(50, "", colorLightGrey);
Plot(0, "", colorLightGrey);
Plot(-50, "", colorLightGrey);

1 comments

Leave Comment

Please login here to leave a comment.