Charge stripes and antiferromagnetism in insulating nickelates and superconducting cuprates