Use a net account-return index adjusted for external cashflows. For this lesson, an episode starts at the latest peak valuation preceding a decline, becomes underwater at the next valuation below that peak, and recovers at the first later valuation at or above the peak. If equal peak values occur before the decline, use the latest one. Report elapsed peak-to-recovery time and, separately, the number of below-peak observations. These are different conventions, so name both.
The running high-water mark is the maximum index observed so far. Deposits should not mechanically create investment recovery. Intraday and daily sampling can produce different peaks and durations; neither sees what happened between its observations.