Coding help needed

 

Hi ... I am a beginner level Mt4 coder trying for an indicator which will plot the difference between the average of the EMAs of four periods and one other ema.

I have written the attached code. As long as I only calculate the average of the EMAs of four periods the indicator shows well. No problems there. But when I try to find its difference with another ema it just fails -- shows just two flat lines.

I must be doing some silly mistake. I do not know what.

I will much appreciate if some one can comment / correct my indicator

Thank you

Files:
Nice_01.mq4  2 kb