For my engine house I used a short section of insulated rail long enough so that the pilot, or tender truck, would close the circuit and light an LED on my contro panel.
take a look at Block signal detectors (DZ-1011) from Z-stuff ($22 for Two)
they have an adjustable proximity detector with a control wire
the infrared detector will detect the position of the engine and then trigger the control wire that could trip an led or of course change the signal light from Green to RED
I think Andre is on the right track, so to speak. You could use the microswitch to interrupt the track voltage instead, to eliminate your reaction time from the operation. In that case, you would need something like a pushbutton or momentary switch to bypass the microswitch so that you could get out again.
I like Andre’s idea with the addition of an overide as suggessted by bob. Just back’em in just in case something were to malfunction when you start them up. Wouldn’t want it to take off suddenly and cra***hru the back of the building