@olavvanderbeek This is due to the fact that you are not using a 'once per bar' block. What you see as a bearish candle was a bullish candle at the exact moment the trade was open. Later on price moved dwon and the candle became a bearish one.
Same with the indicator. What you see now as the position of the evelopes shows the position of it at the moment that was the las candle on the chart. Later on many other candles have been plotted and the indicator repainted the lines plotted to adjust the result. It's not you fault, this is how many indicators work.