A positive outlook is the most important predictor of resilience. It's not just Hollywood magic. Silver Linings Playbook, Life of Pi and some real research:
James Pennebaker, a psychological researcher at the University of Texas in Austin, has found that people who find meaning in adversity are ultimately healthier in the long run than those who do not. In a study, he asked people to write about the darkest, most traumatic experience of their lives for four days in a row for a period of 15 minutes each day.
Analyzing their writing, Pennebaker noticed that the people who benefited most from the exercise were trying to derive meaning from the trauma. They were probing into the causes and consequences of the adversity and, as a result, eventually grew wiser about it. A year later, their medical records showed that the meaning-makers went to the doctor and hospital fewer times than people in the control condition, who wrote about a non-traumatic event.