I'm trying my best to understand how to convert code form v4 to v5 and I have some successful attempts on some easy scripts, but I don't have any code skills, I'm trying to learn by myself the thing I need, but and I miss the basic to understand well what I'm doing really.
So I'm asking you if you can help me with this, so I can learn from this too. Thank you
///....
xATRTrailingStop = 0.0
xATRTrailingStop := iff(src > nz(xATRTrailingStop[1], 0) and src[1] > nz(xATRTrailingStop[1], 0), max(nz(xATRTrailingStop[1]), src - nLoss),
iff(src < nz(xATRTrailingStop[1], 0) and src[1] < nz(xATRTrailingStop[1], 0), min(nz(xATRTrailingStop[1]), src + nLoss),
iff(src > nz(xATRTrailingStop[1], 0), src - nLoss, src + nLoss)))
pos = 0
pos := iff(src[1] < nz(xATRTrailingStop[1], 0) and src > nz(xATRTrailingStop[1], 0), 1,
iff(src[1] > nz(xATRTrailingStop[1], 0) and src < nz(xATRTrailingStop[1], 0), -1, nz(pos[1], 0)))
///...
I tried to convert "iff" to a ternary operator, I'm sorry if that's a mess :/
xATRTrailingStop = 0.0
xATRTrailingStop := (src > nz(xATRTrailingStop[1]) and src[1] > nz(xATRTrailingStop[1]) ? math.max(nz(xATRTrailingStop[1]), src - nLoss) :
(src < nz(xATRTrailingStop[1], 0) and src[1] < nz(xATRTrailingStop[1], 0) ? min(nz(xATRTrailingStop[1]), src + nLoss) :
(src > nz(xATRTrailingStop[1], 0), src - nLoss, src + nLoss))