Help with retrieving equity from historical deals

 
Hello everyone, hope everyone is keeping well.

Just have an issue with the following functions code. All I am trying to do is get a load of data sent to a CSV file from a strategy test. I run the function in the OnTester() function once the strategy test has completed. I have managed to get everything I need so far but am having problems with account equity of every deal. Obviously as they are 'historical deals' one cannot get the equity as easy as. Hence, i tried the following but it does not return the info I require. 

What I am getting now is, for every deal the 'initial balance' adds onto the profit for that deal. (e.g. 10000 + 1.86)

What I would like to be able to do is add the initial balance of the account to every deals profit value cumulatively (so by the end I have something that shows what's left in the account. (i.e. 10001.86 + 1.24 + 2.34 - 3.36 etc.)     

Any help would be greatly appreciated (and as always many thanks in advance!) 

(P.S. I've left out everything regarding outputting to the csv file for ease of understanding) 

void OutputToCSVFile(double initialBalance)
{
    int totalNumOfDeals = HistoryDealsTotal();
    double cumulativeEquity = initialBalance;

    for(int dealID = 0; dealID < totalNumOfDeals; dealID++)
    {
        ulong   dealTicket = HistoryDealGetTicket(dealID);

        double  dealProfit = HistoryDealGetDouble(dealTicket, DEAL_PROFIT);

        double  accEquityAtTradeOpen    =+ cumulativeEquity + dealProfit;

        Print("DealProfit: ", accEquityAtTradeOpen);
    }
}


void OnTester()
{

    OutputToCSVFile(initialBalance); // value retrieved from 'AccountInfoDouble(ACCOUNT_BALANCE)' from within the tested EA (hence gets the     actual starting value)  
}
 

No worries figured it out.

Cheers !