Custom Indicator - Appears and Disappears

 

Hi everyone. I am in a bit of a pickle here. I have written an indicator based on 2 RSI's. I am brainstorming and just thought of this as a mean reversion technique, and just wanted to have a visual of it.

However, it appears and disappears every few seconds?  Where am I going wrong? Please help! I have attached the Indicator, and thanks in advance.

Files:
 

You need to change these lines :

      to_copy=rates_total-prev_calculated+1;    // bars to copy
      limit=rates_total-prev_calculated;        // starting index
Let me know if you understand why or if I have to explain it.
 
Alain Verleyen:

You need to change these lines :

Let me know if you understand why or if I have to explain it.

Dear Alain,

I understand why. Thanks a million for your help.

Reason: