noise and quiet market indicator

 

I am writing a fx program and want to use Heiken Ashi candles to indicate quiet or noise market (to check previous 50 candles red or green and if 5 are the same coloue=quiet, not=noise) but I don know how to do it Can anyone help me please???

Reason: