The machine is only 4 months old? You have what sounds like a major hardware problem. If there has been no accidental damage (water, dropping, stepping on, running over, things like that) Apple covers all repairs and or exchange if called for.
If it works ok with the power adaptor plugged in then it will be the battery and or the charging circuit on the logic board.
The bumping does not make sense unless the it is getting unplugged with the bump.
A bad battery can cause the problem because there is no internal auxiliary battery to hold those settings other than the main battery.
What does the battery icon in the menu bar say? It will be the shape of a AA battery and a black interior showing the approximate charge and or a percentage.
In the Apple menu hold the Option key and click on System Profiler, where it says power see what the battery condition is.
This will tell you if the battery is good, bad, or ugly.
Let me know what you find.