It was meant to be a relaxing break in the Bavarian Alps during a summer break from college. I was staying with a friend's aunt, who ran a hotel. One Monday morning, I set out for a hike in the sunshine. But after an hour or so fog started to roll in and, as it thickened, I became lost in a web of trails.

Each time I followed a track it led nowhere and the situation swiftly took on the sensation of a bad dream. I climbed on to a ledge overlooking a deep valley to peek over and orient myself, but could see nothing. I tried to scramble back up to the trail but slipped and fell 15ft back down again.

I crashed against rock, barely stopping myself from rolling straight off the ledge into the valley below. I'd broken four ribs, fractured my ankle and dislocated my shoulder – the pain made this instantly obvious, and my arm hung limply at my side.

I had no phone, water or food – I had planned to be gone for only a few hours. I sat in the rain all night, calling for help, my neoprene top offering little protection against the cold.

The ledge sloped up too steeply for me to climb out. But by dawn I had spotted a nearby waterfall, and above me a large cave. Leaning on a stick, I made my way carefully up the steep slope to the cave. Outside the entrance I could see a cable, typical of the looped systems used by logging companies in the area to haul wood up the mountain. I assumed it must be out of action, which is why half of it lay slack on the ground. The taut half of the pulley, heading back down the valley, was 30 feet above my head.

Inside the cave I found an empty plastic bottle which I used to collect water dripping from the roof. I spent the rest of the day sitting in front of the cave, hoping my yellow shirt would be bright enough to attract the attention of any potential rescuers – I knew the alarm would have been raised when I'd failed to return to the hotel by nightfall. Sure enough, I later heard helicopters whirring nearby. I tried to make myself as visible as possible, standing up and waving my good arm, but the sound receded into the distance and as darkness fell I went back to the cave.

During the second day, I was sitting outside again, waiting for the helicopters to return, when the cable lying along the ground suddenly jerked. Realising this might be my only opportunity to send a signal down into the valley, I did a quick stocktake. All I had was the clothes I stood up in – and the item that seemed most expendable and likely to have the most impact was my bra. I quickly undid it and tied it to the cable. Seconds later, the whole length rose into the air, way out of my reach, and my bra was swiftly carried away and out of sight.

That night I heard helicopters again, but rushed out of the cave too late to attract their attention – I later heard they'd been using infrared devices to try to detect body heat. By this time, I'd eaten nothing for three days and the cave had produced only about a cup and a half of water. I carefully made my way down to the waterfall, drank my fill and washed the blood and dirt out of my clothes. That's when I heard the helicopters again. Gripping the water bottle between my teeth, I used my stick to scramble back up to the plateau. It was about an hour later that I was spotted.

My body had partly shut down, I think, blocking out most of the pain I should have been feeling. In hospital, though, I felt everything. I struggled to breathe, due to a partly deflated lung, and walked with a stoop for weeks. I had also become host to 40 hungry ticks, each of which had to be carefully removed. It was a fortnight before I was well enough to leave the country and, four years on, I'm still having operations to fix my ankle.

I learned that the rescue operation – 80 people on foot, supported by five helicopters – would soon have been called off. They'd been searching in the wrong area until the worker testing the pulley had discovered my bra and raised the alarm. After that, it was simply a case of following the cable up the mountain. I try not to dwell too much on the overwhelming coincidence that led to him testing the line that day and spotting my bra.

• As told to Chris Broughton

Do you have an experience to share? Email experience@theguardian.com