You dont need to program anything. The moving average indicator has properties that can be set that will plot an envelope, when setting the properties for the moving average, look for a tab labelled "levels", and you can add an upper and lower band. If you want 16 pips, you need to add levels as 16 and -16