I do not see immediately a bug with bool variables in your code, so it might be caused by a particular type of bug in the rest of your script. When it happens after the 14th call, check what your code is doing after 14 bars. If you can't find the bug quickly, comment out parts of your code step by step until the problem disappears. The bug was then in the last removed code part.