Thank you for a reply! That was the first thing I did - compared both versions and I can confirm the source code is different, and when I copy pasted the previous implementation to my custom indicators script and use it, the backtest showed the original performance metrics - confirming the recoded version indeed changed the strategy.

Original code (indicators.c):
Code
// Zorro's Market Meanness Index
var MMI(var* Data,int TimePeriod)
{
// clip time period to history length
	TimePeriod = Min(TimePeriod,1000);
	checkLookBack(TimePeriod);
	TimePeriod = Min((uint)TimePeriod,g->nBar-1);
	if(TimePeriod < 2) return 75;
// calculate MMI statistics
	var m = Median(Data,TimePeriod); 
	int i, nh=0, nl=0;
	for(i=1; i<TimePeriod; i++) {
		if(Data[i] > m && Data[i] > Data[i-1])
			nl++;
		else if(Data[i] < m && Data[i] < Data[i-1])
			nh++;
	}
	return 100.*(nl+nh)/(TimePeriod-1);
}



Recoded version (indicators.c):
Code
// Zorro's Market Meanness Index
var MMI(var* Data,int TimePeriod)
{
	checkLookBack(TimePeriod);
// clip time period to history length
	TimePeriod = Min((uint)TimePeriod,g->nBar-2);
	if(TimePeriod < 2) return 75;
// calculate MMI statistics
	var m = Median(Data,TimePeriod|1); 
	int i, nh=0, nl=0;
	for(i=1; i<TimePeriod; i++) {
		if(Data[i] > m && Data[i] > Data[i-1])
			nl++;
		else if(Data[i] < m && Data[i] < Data[i-1])
			nh++;
	}
	return 100.*(nl+nh)/(TimePeriod-1);
}


Here are the changes
[Linked Image]

It seems like the previous version is matching the "classic" version you mentioned slightly more, probably indicating the recoded version is somehow flawed.

Attached Files
mmi.png (40 downloads)
Last edited by 11honza11; 06/02/26 11:40.