Add to composite - need some help explaining how it works

Hi,

I tried to understand how the addtocomposite works and it is over my head. I managed to use it and got what I want which was creating sector composites. That was a code with lots of copying and pasting, to create one composite for each sector. Then I found this amazing document which explains lots of details, most of it is extremely hard for me to understand. Long story short, I found that all I have to do, it just write a short code and that code confused me big time.

The source of the code is this document: http://www.amibroker.org/3rdparty/IntroToAtc.pdf

the code to create sector composites obtained from that document:

sym = "~" + SectorID(1);
AddToComposite( L, sym,"L");
AddToComposite( O, sym,"O");
AddToComposite( H, sym,"H");
AddToComposite( C, sym,"C");
AddToComposite( V, sym, "V");
Buy=Sell=Short=Cover=0;
Filter=1; 

I don't understand how did this work. How the code created all sectors without pointing which sectors to create?
I thought that I have to check each symbol sector ID before adding it to the composite.

Thank you