theory:

Quote
where n is the number of days(period) that the price is closed higher than the previous period.


but

zorro fce sumUp - not calculate how many is close Price higher the price older, but sumOfprice if is highers

Code
var vUp, vDn;
var ProfitFactor(var* Data,int Length)
{
	vUp = 0.,vDn = 0.;
	for(int i=1; i<Length; i++) {
		if(Data[i-1] > Data[i])
			vUp += Data[i-1]-Data[i];
		else
			vDn += Data[i]-Data[i-1];
	}
	if(vDn == 0.) 
		return vUp == 0.? 1. : 10.;
	return Clamp(vUp/vDn,0.,9.999);
}

var SumUp(var* Data,int Length)
{
	ProfitFactor(Data,Length);
	return vUp;
}