run() is a just a regular function, that gets' called at each bar (by a Zorro's engine).

So, all variables declared in run are 'local', i.e. they get destroyed/ reinitialized at each new run ().

To retain their values, you need to declare them static or global (i.e. outside run() )..or save them in a series object.