All lot of the formula techniques are similar to before but the bug change was creating a calculated table to complete a lot of the hard work first.
See below
Also the solution is iterating through Dates, rather than the Trade table which becomes far more efficient.
See how you go with this