Теория:

Study some signal words for Past Perfect Continuous.
 
  
Words for Past Perfect Continuous:
  
for — в течение;
  
since — с, с какого-то момента;
  
when — когда;
  
how long — как долго;
  
before — до того.

 
Examples
  
In \(2014\) The Browns had been living in London for twenty years.
 
palace-530055_640.png
Рис. \(1\). London

I had been working for this company since \(2017\).

We had been waiting for Mary since morning when she finally arrived at \(5\) pm.

They had been watching TV when the lights went off.
  
tv-5017870_640.png
Рис. \(2\). Watching TV

How long had you been waiting before he came?

James had been teaching at the university for more than a year before he left for London.
Источники:
Рис. 1. London, 2013, https://pixabay.com/images/id-530055/ Pixabay License CC0 Free for commercial use No attribution required
Рис. 2. Watching TV, 2014, https://pixabay.com/images/id-5017870/ Pixabay License CC0 Free for commercial use No attribution required