Buffer values on new bar get set to 0.00

 

For a learning project I took a default indicator such as OBV and wanted to start the process of finding divergences so using the inbuilt Fractals code as a start to find pivots. In this code I have an EMA on the OBV which can be ignored as the same buffer/new bar to 0 behavior occurs. That said a friend and I have spent a few days troubleshooting and reviewing quite a bit of the wealth of info that is in these forums but trying to understand the why here. 

When loaded im noticing in the upper left of the indicator window where the shortname and readings are there are two entries of 0.00 which im assuming are the 2 buffers for the Fractal (up/down) but still unsure what piece im missing here from a functionality standpoint. Thanks in advance!

and as always if there's any mandatory reading that I somehow haven't come across yet by all means lmk and appreciate the insights. 

Files:
OBV_DIVS.mq5  9 kb
 
Joshua McGowan:

For a learning project I took a default indicator such as OBV and wanted to start the process of finding divergences so using the inbuilt Fractals code as a start to find pivots. In this code I have an EMA on the OBV which can be ignored as the same buffer/new bar to 0 behavior occurs. That said a friend and I have spent a few days troubleshooting and reviewing quite a bit of the wealth of info that is in these forums but trying to understand the why here. 

When loaded im noticing in the upper left of the indicator window where the shortname and readings are there are two entries of 0.00 which im assuming are the 2 buffers for the Fractal (up/down) but still unsure what piece im missing here from a functionality standpoint. Thanks in advance!

and as always if there's any mandatory reading that I somehow haven't come across yet by all means lmk and appreciate the insights. 

Line 81: Tells your program to start drawing at candle number 13 on the current TF.

 
Thank-god Avwerosuoghene Odukudu #:

Line 81: Tells your program to start drawing at candle number 13 on the current TF.

Thank you for the feedback. My question is why after I load it, say on a 1min chart, everything is fine until a new bar fires and the fractal arrows get set to 0? Or is your response explaining that and Im not putting the two together? Thanks for your time.

 
Here's 2 screen shots to make it easier to see the issue/question. On first load everything is good, although in the upper left I can see the fractal buffers showing 0.00 and 0.00 for both up/down fractals, these on init should be set to EMPTY_VALUE not 0.00. In any case on a new bar the fractals go to 0.00 and everything goes sideways. 
Reason: