How to make same result (graphical) between manual and coding in metatrader4 chart ?

 

Dear all,

I have problem

When i overlay two indicators rsi(2) and then cci(6) in one window manually (just add rsi(2) and then drag cci(6) into rsi(2) window, as graphical is ok.

Look at the bottom of the chart.

But I coding custom indicator for same purpose. the result is similar but rather strange.

some cci overlap the the upperline ( I point it in red arrow, middle of the window) different with I do it manually.

I think, I missing something in coding or I make some bugs.

Below the the chart and the coding.

Thx before for all your help

Best regards

Hans 

Files:
atest.mq4  2 kb
Reason: