Average reference specification in Custom Montage

Hello there,

Below, I show a custom montage that I made for my polysomnography study.
I would like to specify EEG average reference (or any other types of reference) for each of these EEG channels and was wondering how I should do this.======= I am assuming it would be related to this link but was not sure.

Many thanks!

Fore each line, with a custom montage, you'd have to explicitly compute this average reference, i.e. sum of all the electrodes divided by the number N of electrodes included in the average (replace X with the actual value 1/N):

Fp1|333333 : Fp1, -X*Fpz, -X*Fp2, -X*F3, .......

This is very impractical. Alternatively, you can add the EEG average reference as a linear operator in the continuous file, and then use the simple montage you posted. If you haven't followed this EEG tutorial yet, I recommend you do so before going further with the analysis of your own recordings.
https://neuroimage.usc.edu/brainstorm/Tutorials/Epilepsy#Average_reference