Balance and Equity for each order in history, is it possible ?

 

Hello

Is there a way to get balance and equity of each closed order in history by ticket ?

I want to add Balance and Equity for each history order to upload on website for easier data handling for charts, but i stuck on this step.

I managed to get properly Balance and Equity by looping through all history in descending order starting from first deposit and assign balance += profit + swap + commission, but problem with that is that this is working only once, if there is a new history orders then all previous values are not valid if i repeat process.

I tried to delete whole history on each upload but this isn't good solution.

Anyone have any other idea or better solution for this ?

Thanks in advance.

Reason: