I suggest a "blank-value calculation system" in which the total of the gained/lost XP will always add up to 0.
Total XP = XP Gained - XP Lost
Furthermore the XP Gain/Loss should be related to:
- average XP
- your own XP
- summary of race results (qualifying result, race result, fastest lap)
each of these aspects should be factorized somehow and put up into the final XP-Calculation formula. In the end these calculations will be subordinated to the blank value calculation system