Yes you are correct, my version is not exactly like Ehlers code.
But in my defense if you look at his code you will see that he always looks at the current values bar values and the preveious bar values so what I did was just copy the preveious bar values into the A variables
Thanks
EK