What has always been helping me whenever this happens is to step away from the screen of my phone or laptop( as the case may be). I also try to stick to a plan, once I have set my entry and exit I try very much not to second guess cos the market is moving. Journaling my trade also helps me to notice patterns in my emotional response.
This is the best reaction to coping with an emotional swing in trading. I will add to it, find a trading community with a common interest where thoughts, opinions and advice are shared. We draw strength from the experiences of other people. We learn from them and we learn that our own situation is not as unique as we thought. If this is not a coping mechanism that you lean towards, reading trading books, biographies or autobiographies of others is also a huge help resposne to it.