Red, green, and yellow traffic lights developed directly from the trial and error of controlling railways during the nineteenth century.
Trains needed advance warning to prevent fatal accidents and collisions.
The first choice was red for stop, which was logical because red had symbolized danger for thousands of years.
During the 1830s, engineers tried using green for caution and clear for go, but sunlight reflecting off clear lights gave false signals.
So engineers solved the problem by introducing yellow for caution and making green stand for go.
The very first traffic light using this system was introduced in Cleveland, Ohio, in 1914.