Current Bar Problem.

 
Can someone help me with why my indicator does not supply data for the first bar on my chart. I suspect it has something to do with my array but I cannot figure why the data is delayed one bar.
Reason: