Guys,

could you find what exactly going wrong with my simple code. All I want is to count the number of times the close crossingOver 9ma.

For some reason the count not getting incremented with SUM() function and if i use TOTALSum() it counting all the crossovers in the chart.

here is the code:

def tt = ( close crosses above MovAvgExponential()."AvgExp" );

def ctr = if isNaN(tt) then ctr[1] else tt;

def TotCross = Sum(ctr) ;

AddChartBubble((tt ), high, ""+TotCross , Color.green, yes)

With Sum here is the chart:

with TOTAL SUM:

could you find what exactly going wrong with my simple code. All I want is to count the number of times the close crossingOver 9ma.

For some reason the count not getting incremented with SUM() function and if i use TOTALSum() it counting all the crossovers in the chart.

here is the code:

def tt = ( close crosses above MovAvgExponential()."AvgExp" );

def ctr = if isNaN(tt) then ctr[1] else tt;

def TotCross = Sum(ctr) ;

AddChartBubble((tt ), high, ""+TotCross , Color.green, yes)

With Sum here is the chart:

with TOTAL SUM:

Last edited by a moderator: