MT4 use bucket of trades, MT4 or MT5 reset variable to 0, for each trade, formula with profit to a pink loop + variable and save into the same variable. (every time a trade is selected the profit will be added in the formula)
If my suggestions don't work the reason must be somewhere else in the srtucture. If I can't see it, I cannot be more helpful, sorry. Your current loginc is correct and should work.