That's a difficult question. I used to have sort of problems like that too. They just went away a few years ago and they don't come back anymore.
To solve this kind of problem requires a change on a mental level. I'm not a qualified psychologist, but I'll tell you what should work. In the bible they talk a lot about living in the moment that you're in. You have to focus on what's going on right now, not what happened before. You have to learn to be indifferent to the past. Sure you learn from the past and the usual, but there is no need to mix it with the present.
A lot of "depression" of that sort comes from too much reflection. To put it bluntly, you think too much. Now how do you fix this??
To stop thinking so much is
EXTREMELY difficult. It takes a lot of work, and does not just come all of the sudden. It took me about 6-7 months before I realized it. You must sort of train yourself gradually to understand the uslessness of thought in most cases. I'd recommend to be kept busy, so anything you can do to stop your thinking such as: reading, going to the gym, even studying if it shuts up your head.
If you refer to the bible for generally any posts that have to do with thought, they'll reccomend you some good ideas to work on.
The thing is depression like the kind you are talking about is thought provoked. The more you reflect on it, the more it affects you. When you eliminate thought, you eliminate that effect. Remember, almost everyone goes through this, and by realizing that it's not natural, you've already taken a step forward. So go back to the bible, read the posts that I reccomend, and see if it helps you out. The
Get a boost up! section has a lot of things like that. Try it out!