Grat,
I think there is something not as it should be, look at the plot below.
I did try already to change your code, eventually I will get it done, just if you say yours is not nice, mine will be horrible....
double idxPL(){
int sumUP = AssetInt[_SUM_PLUS];
int sumDN = AssetInt[_SUM_MINUS];
var pl=0;
if (priceClose() > priceClose(1)){
sumUP++;
sumDN=0;
pl=(sumUP/12.0)*100;
}
if (priceClose() < priceClose(1)){
sumUP=0;
sumDN++;
pl=-(sumDN/12.0)*100;
}
//watch("\n",sumDN,sumUP,pl);
AssetInt[_SUM_PLUS] = sumUP;
AssetInt[_SUM_MINUS]= sumDN;
return pl;
}
I think it goes too sharp down, as far I understand, the code above returns either the minus count or the plus count.
But in case to make your idea work with the down count, ther must be something like sumUP-sumDN if sumUP is bigger than sumDN, and the other way round sumDown - sumUP if sumDN is bigger than sumUP.
Of course only, if the opposite bar / close occurs.