When you haven't finished your first 20 games, your rating is provisional. Provisional ratings are calculated this way:
If you win, you will get the rating of the other player plus 400 points (if the other player is also provisional, it is 200)
If you draw, you will get the rating of the other player
If you lose, you will get the rating of the other player minus 400 points ( 200 if the other one is also provisional).
your rating is calculated as the mean of your total points earned by playing a game.
An example: you win first match against player rated 1400
Second you lose against player rated: 1000
The you win from a player rated p 1200
And then you draw 2 games against a player rated 1300
your rating will be: 1400 + 400 + 1000 - 400 + 1200 + 200 + 1300 + 1300= 6400.
you played 5 games, so your new rating will be p 1280. Then if you win your next game from a player with rating p 800, your rating will be (6400 + 800 + 200)/6=p 1233, so your rating decreased.
I hope I explained it well. You can also read the FAQ of the help. It is also explained there and you can see how ratings are calculated if you are no provisional anymore.
Regards,
Sander