Mql5 OHLC, ATR

 
Hello, when i'm building EA sometime i get ATR/OHLC wrong values. After few attempt they start getting correct and they never becomes incorrect. I have no idea why exactly this happening. I'm guessing it happens when i change timeframe, or when EA is just attached to chart, somehow it needs to load some data to read correct values from OHLC table. 
 

Do you really expect an answer? There are no mind readers here and our crystal balls are cracked.
     How To Ask Questions The Smart Way. (2004)
          Be precise and informative about your problem

We can't see your broken code.

Always post all relevant code (using Code button) or attach the source file.

 
Providing more detail info. In code i have nothing different or complicated. 

int atrH = iATR(Symbol(),0,14);


double ATR()
{
        double v[];
        ArraySetAsSeries(v,true);
        CopyBuffer(atrH,0,0,2,v);
        return v[1];
}
This is what i'm using in EA. Imagine previous candle (index 1) ATR is 0.00391. But when i call ATR() function in EA sometime it gives me weird value for example 2.130214( i don't know any amount) and after few call of this function. It gives me correct ( 0.00391) value every time.
Just i need to know what causes EA to send incorrect value through ATR function.