Calculation methods for supply and demand zone indicators

 
Hi community, what do you guys think the best approach would be for defining supply and demand zones - in an indicator?

1. Studying a few of the free indicators already available I can’t quite understand from reading the code how the zones are calculated. Attached is
the best one I’ve come across. I’d be grateful if any coders could identify the bit of code and tell me how the zones are calculated. (Are ZZ’s or fibs used?)

2. Another I am studying states: zone border is calculated using an average value of open and close prices of neighbouring bars.
I can’t completely grasp this. How would that look in a mathematical calculation?

Thanks for your input.
Files:
 
Topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.
I have moved your topic to the MQL4 and Metatrader 4 section.
 
Keith Watford:
Topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.
I have moved your topic to the MQL4 and Metatrader 4 section.

Arrgh, apologies Keith. Thanks for your help.