Ignition scripting is Python (or Jython), isn't it? That is not to different from simple ST. Anyway, the language doesn't really matter. It's the algorithm that needs to be right, especially for the edge cases.
One major edge case is noise in the signal.
For example, one simple approach would be to attribute any increase in level as material being added to the tank, and any decrease in level as material being removed from the tank and delivered downstream.
It seems like it is the former that you are looking for. So a simple approach would be to subtract the current level from the previous level, and if the result is positive then add it to the running total. However, what if all valves are closed and any variation in level is only due to noise in the instrument, so it goes up 0.01 inch, then down 0.01 inch, then up, then down, etc.? The simple approach described would add each down-to-up transition to the running total, even though no liquid was entering the tank.
To deal with that noise, with no other information, the code could keep track of the most recent maximum and minimum levels, and any time the current level goes more than some amount below the maximum, then assume that indicates the start of a draining event, and vice versa for filling events. So draining event triggers (1) using the last minimum to the current maximum as the amount to ADD to the running total, and (2) resetting the minimum to the current value. Likewise a filling event triggers resetting the maximum to the current value.
You also mention that there is some indication of when the tank is filling and/or when it is draining, so perhaps that could also be used to trigger when the maximum and minimum values are reset.
There are probably other edge cases e.g. what about power cycles? What about operator errors? That is where you are going to spend the most time.