Not sure I fully get it. Please confirm you need a trade to be open if candle ID 1 crossed above (red?) MA and then price crosses above Candle ID 1's high? Is that correct?
If something stops working as I know it should, I start the project new (normally by copying and pasting blocks). this will normally correct issues, although FX uses MetaTrader code to create projects there is other computing going on on the website.
(I tried to incorporate your example into that "almost working robot" like this: https://fxdreema.com/shared/aPkR3pSad but then it is not working at all - what I see is "Flag" variable is updated by 11th block all the time)