Vvertical offset % function to a SMA

is it possible to add a vertical offset in % function to a SMA?

My aim is to attach this SMA to a 1 period ATR.


I'm not good with coding so I tried to use already existent indicators, which don't work. I tried to modify already existent codes but I cannot achieve what I need


  • Just calculate your SMA and add 1% to its value.

    indicator("My script", overlay=true)
    offset = input.int(1, "Offset [%]") * 0.01
    sma_val = ta.sma(close, 9)
    sma_offset_val = sma_val * (1 + offset)
    plot(sma_val, "SMA", color.green)
    plot(sma_offset_val, "SMA Offset", color.red)

    enter image description here