I needed the atr indicator as trailing stop, but I couldnt find super trend in QC. So I tried to build one. And here it is.

Since I am not 100% sure the code is correct, please review the code before you use it. If theres any bugs or super trend already in QC, please let me know.

And the code is based on tradingview super trend in pinescript, and here is the code:

study("abc", overlay=true)
Periods = input(title="ATR Period", type=input.integer, defval=10)
Multiplier = input(title="ATR Multiplier", type=input.float, step=0.1, defval=2.0)

atr = atr(Periods)
atrDown = hl2 - (Multiplier*atr)
atrDown := close[1] > atrDown[1] ? max(atrDown, atrDown[1]) : atrDown
atrUp = hl2 + (Multiplier*atr)
atrUp := close[1] < atrUp[1] ? min(atrUp, atrUp[1]) : atrUp

atrTrend = 0
atrTrend := nz(atrTrend[1], atrTrend)
atrTrend := close > atrUp[1] ? 1 : close < atrDown[1] ? -1 : atrTrend[1]

upPlot = plot(atrTrend == -1 ? atrUp : na, style=plot.style_linebr, linewidth=2, color=color.red)
downPlot = plot(atrTrend == 1 ? atrDown : na, style=plot.style_linebr, linewidth=2, color=color.green)
closePlot = plot(close)
fill(upPlot, closePlot, color=color.red)
fill(downPlot, closePlot, color=color.green)