In real life, railroad Signaling is not like traffic lights where they are based on a timer and expect traffic to respond to it. Instead, the Signal should indicate the state of the track block(s) behind it.
Signaling can get complicated very quickly, I think the simplest approach is to look at an ABS System (Automatic Block Signaling) example. Assuming you have three aspects on your signal (for example red, yellow or green), If the green aspect is seen when approaching signal from the engineers perspective, the next two track blocks (track circuits) after the signal should be clear (no train occupancy). If the yellow aspect is displayed only a single block behind the signal is clear. Is the red aspect is displayed the next track block is not clear
Where one signal governs different direction than the other signal, but both are at the same location, if circuit before and after the location are occupied at the same time (such as when the train passes by the Signals), both Signals should be red.
I think a quick search on google for "three aspect railroad signaling" might have some good visual images. Maybe try this link from which I took the following image: http://www.railway-technical.com/US-sig.shtml