Chosen Solution

When the MacBook is open a tiny bit it will turn on but as soon as you open it further it turns off. And won’t turn back on unless you close it and them open it a tiny bit again.

The 2016 series onwards is a radical change! Unlike the older models which snuck the Display Cable through the hinge. Apple decided they would move the T-CON board which was at the bottom of the display assembly to the main body. Here’s the older design:

And here’s the newer design

And here’s a deeper view of the connections

So as you can see there’s a lot more cables in this design! So back to your problem! What you are encountering is a failing ribbon cable between the T-CON board and the LCD panel within the display. Did you bump your system along the black edge of the display? A good bang could have damaged the cable. There was an extended warranty on the 13” models as the backlight cable turned out to be short causing it to fail from the tugging. Here’s more it it The Design Flaw Behind MacBook Pro’s “Stage Light” Effect and here’s the fix 2018 MacBook Pros Try to Solve Flexgate Without Admitting It Exists So to verify this is your issue you’ll want to see if an external monitor works without any issues if it does then you know you have a display issue and you’ll need to replace it MacBook Pro 15" Touch Bar 2017 Screen Replacement