Why do I have this feeling that you want to work with Renko charts. If you don't know these, look at them.

Otherwise what you want to do probably requires few variables, maybe arrays, or maybe a whole custom block to collect and process that data. Or indicator.