I collected all of this data myself. Battles include any official battles (gym, contest, any with a referee, etc.) and battles with major characters/rivals. They do NOT include other unofficial battles (including battles with Team Rocket), any battles that were interrupted, battles where one side cheated, or battles with wild Pokémon.
The percentage is # of battles won divided by # of total battles (minus ties). Ties are included in the # of battles, but removed from calculating the percentage. Pokémon that were traded only include the battles under Ash's ownership.
Another important note on how this was all calculated - the battles/percentages are calculated based on battles between the individual Pokémon, not the overall trainer battle. So, a Pokémon gets one "win" when its current opponent is KO'd, and one loss when it gets KO'd. For example, if a Pokémon KO's two opponents and gets KO'd by a third Pokémon all in one trainer battle, that counts as three "battles," two "wins," and one "loss" for that Pokémon.
The percentage is # of battles won divided by # of total battles (minus ties). Ties are included in the # of battles, but removed from calculating the percentage. Pokémon that were traded only include the battles under Ash's ownership.