To keep your mind calm, first you need to stop being reactive.
The simple truth is that your mind oscillates wildly only when you let your mind react. If you let your mind react to things happening around you, your mind has only two mental slots it can fall back on by default: excitement or dejection. Both blind you.
The next question is how do you stop reacting?
It’s done by observing irresponsibly how your mind works with things happening around you. This “irresponsibly” part is a little trick I discovered that made it really easy for me to create a meta-entity that observes what’s happening around me. In practice, you just need to tell yourself whatever that’s happening right now is happening to someone other than you; hence you remain a non-implicated spectator. A bad guy. But you’re safe.
Such irresponsible observation clearly points you to what you have control over and not. The result is that mistakes hardly demoralize you, failures don’t paralyze you, and that you move on like a cool guy.
Once you calm your mind, make it a rule to observe irresponsibly.
 There's nothing that's happening to you. Everything happens around or away from you.  Think of yourself watching a movie where you're a main character.