Gates are the proper solution. But then you need walls all along the rail, or need to remember to only cross the rail at these crossings. If you need something quick and dirty:
Connect a signal to a colored light, space them so that you always have at least one of these lights on screen. Or connect the signal to a programmable speaker, and make it play some sound which warns you.
You can link gates to circuit network! You can either read a train signal and force close the pedestrian gate, or better yet read the pedestrian gate and force close the train gate. Forcing the train signal red sometimes doesn't stop the train in time, but force closing the gate does, with hilarious consequences. Hey, better them than you!