When displaying the "greatest" values to the console I found that it changes if I uncomment the last line. Moreover, it changes to a value (1709.99) that was neither in longStop nor in longStop before. Where could it come from?
Screenshot without the last line:

Screenshot with last line:

Here is my small script:
//@version=4
strategy("CE", shorttitle="CE", overlay=true)
length = input(title="ATR P", type=input.integer, defval=22)
mult = input(title="ATR M", type=input.float, step=0.1, defval=3.0)
atr = mult * atr(length)
// debug = label.new(x = bar_index, y = close, style = label.style_label_left, text = stri)
// label.delete(debug[1])
// plot(atr, color=color.yellow, linewidth=1)
// plotchar(bar_index, "Bar Index", "", location = location.top)
longStop = highest(close, length) - atr
// /plot(close[1] - mult * atr(length)[1], title = "longStopPrev", color=color.blue, linewidth=1)
longStopPrev = longStop[1]
plotchar(longStop, "longStop", "", location = location.top)
plotchar(longStopPrev, "longStopPrev", "", location = location.top)
greatest = max(longStop, longStopPrev)
// plot(greatest, title = "greatest", color=color.blue, linewidth=1)
plotchar(greatest, "greatest", "", location = location.top)
longStop := close[1] > longStopPrev ? greatest : longStop