Formula:
study(title="Tarzan's spread ratio indicator")
smalen = input(title = "sma length", defval=6, minval=1)
stype = input(title = "spread type 1=+ 2=- 3=/ 4=*", defval=3, minval=1)
s1 = input(title = "Security #1", defval="DX1!")
s2 = input(title = "Security #2", defval="TY1!")
tenyrnotes=s1
dollarindex=s2
notes = sma(security(tenyrnotes, "D", close) , smalen)
DX = sma(security(dollarindex, "D", close) , smalen)
DXS = (stype==1 ) ? (notes+DX) :
(stype==2 ) ? (notes-DX) :
(stype==3 ) ? (notes/DX) :
(stype==4 ) ? (notes*DX) : na
plot((DXS), color=blue)