The invention relates to a traffic signal lamp with a rain shielding function. The lamp comprises a supporting rod, a mounting base, a main body and two lamp bodies, a rain shielding mechanism and a power generation mechanism are further included, wherein the rain shielding mechanism comprises a fixing box, a water drainage pipe, a branch pipe, a power assembly and two rain shielding assemblies, the power assembly comprises a rotating shaft, two first bearings and two power units, the rain blocking assembly comprises a baffle, a connecting rod, a piston, a connecting pipe, a driving box, a transmission unit, a friction disc, an abutting disc, a moving plate and a spring, the power generation mechanism comprises two power generation assemblies, and the power generation assembly comprises agenerator, a first gear and a second gear. According to the traffic signal lamp with the rain shielding function, the rain shielding mechanism is arranged, the rain shielding function is achieved, rainwater is prevented from covering the lamp body and affecting the lighting indication effect of the lamp body, the power generation function is achieved through the power generation mechanism, electric energy can be provided for equipment, the situation that the equipment cannot work normally due to urban power grid outage is avoided, and therefore practicability of the equipment is improved.