Howto Count how many bars after 2 MA's crossed

 

Hi folks,


Is it possible to count how many bars after 2 MA's crossed and displayed in the main chart??..


Thanks

 

arfian wrote >>

Is it possible to count how many bars after 2 MA's crossed and displayed in the main chart??..

yes

 
meikel:

yes


Can you tell me the code sir?...


Thanks for your kind help.

 

start() {

static count

if (new bar) count++

if (mas crossed) count=0

Comment(count);

}

 
WHRoeder:

start() {

static count

if (new bar) count++

if (mas crossed) count=0

Comment(count);

}

I tried to insert the code to the indicator, but always got error when compile the indicator. I attach the original indicator. Thank you for your kind help sir.

Reason: