Gold Silver Spread
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © bensonsuntw
// updation inspired by Morty

//@version=4
study("Gold Silver Spread")

s1 = input(title="pair1",type=input.symbol,defval="MCX:SILVERM1!")
s2 = input(title="pair2",type=input.symbol,defval="MCX:GOLDM1!")

f() => [open,high,low,close]

[o1,h1,l1,c1]=security(s1,timeframe.period,f())
[o2,h2,l2,c2]=security(s2,timeframe.period,f())


plotcandle(o1-o2, h1-h2, l1-l2, c1-c2,color = o1-o2 < c1-c2 ? color.green : color.red, wickcolor=color.black)


