This is what the highway code says:
Rule 291
A level crossing is where a road crosses a railway or tramway line. Approach and cross it with care. Never drive onto a crossing until the road is clear on the other side and do not get too close to the car in front.
Rule 293
Controlled Crossings. Most crossings have traffic light signals with a steady amber light, twin flashing red stop lights (see
‘Light signals controlling traffic’ and
‘Traffic signs’) and an audible alarm for pedestrians. They may have full, half or no barriers.
- You MUST always obey the flashing red stop lights.
- You MUST stop behind the white line across the road.
- Keep going if you have already crossed the white line when the amber light comes on.
For ordinary traffic lights it says:
AMBER means ‘Stop’ at the stop line. You may go on only if the AMBER appears after you have crossed the stop line or are so close to it that to pull up might cause an accident
GREEN means you may go on if the way is clear. Take special care if you intend to turn left or right and give way to pedestrians who are crossing
In a way the Code is not specific on these matters leaving a wide room for interpretation. The key however is not to go through on red. I have seen specimen test paper answers where if the light is green you do not need to slow down other papers give different answers, you should maintain your speed. I find this difficult to follow totally as it depends on your speed, how far you are away from the lights etc. I have seen a video blog by a driving instructor who says that once you reach a certain point approaching lights, without reducing your legal/sensible speed if they change to amber you go through, in fact he says at this point onwards do not look at the lights concentrate on the road. Of course this "point" is open to interpretation and experience. Personally I approach lights so that I could stop by the time they get to red even if it means slowing down a little, but will go through on amber if too close to stop safely. For level crossing I tend to be a little more cautious as you never know what the road condition over them is like. So I cannot see what you did was wrong, it depends only if you crossed the stop line on red.