This script uses Heikin Ashi candles to smooth out the candles, then counts how many consecutive candles in a row are the same colour (red or green). It then takes each count and multiples it by the difference between close and open, to provide a weighted movement.
Where larger moves create greater impulses.