According to Feng Shui experts it is bad to sleep under a window since when you sleep under a window your personal energy tends to get weaker over time since it has no proper support or protection.
So for Feng Shui it's best to sleep with your head away from a window and use a headboard on your bed as well as having the headboard of your bed in front of a solid wall.