Markets traded volatile but managed to settle with gains on Tuesday. The BSE Sensex ended at 51,025.48, up 584.41 points or 1.16%. The Nifty ended at 15,098.40, up 142.20 points or 0.95%.