Question I keep losing video outout from my pc

Jun 30, 2019
7
0
10
Whenever I try to boot my pc, it first shows me the log in screen but then my pc stops giving a video ouput and freezes. I can't turn it off normally but instead I have to hold the power button for 5 seconds. I have tried placing my gpu in a different pci-e slot and have managed to succesfully log in and use my pc without losing video output. But after a while it crashes randomly. First my pc becomes unresponsive and then I lose video output again. What is the issue with my pc and what should I do to fix this?

My specs:
CPU: Amd ryzen 1600
Mobo: MSI B350 gaming pro carbon
GPU: MSI GTX 1050ti gaming x 4g
PSU: Seasonic M12II evo 520w
RAM: Kingston hyperx fury 2 x 4gb 2666mhz
SSD: Samsung 850 evo 250gb
HDD: Seagate barracuda 1tb 7200rpm
OS: Windows 10