Swap Trading Pair Price 
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © jasonyl13579

//@version=4
study("Swap Pair", overlay=false, precision=6)
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/


symbol_in1 = input("SOL", "Symbol", type=input.string, group='Swap pair symbol1')
exchange_symbol1 = input("BINANCE", "Exchange", type=input.string, options=["BINANCE", "FTX","OKEX","COINEX"], group='Swap pair symbol1')
symbol_in2 = input("GST", "Symbol", type=input.string, group='Swap pair symbol2')
exchange_symbol2 = input("COINEX", "Exchange", type=input.string, options=["BINANCE", "FTX","OKEX","COINEX"], group='Swap pair symbol2')

src = input(hlc3, title="Source", type=input.source)
upper = input(23, "Upper", type=input.float, step=0.001, minval=0, group='Threshold')
lower = input(31, "Lower", type=input.float, step=0.001, maxval=0, group='Threshold')
mid = (upper + lower) / 2
// get datas
f() => [src, volume]

[p1, v1] = security(exchange_symbol1 +':' + symbol_in1 + "USDT", timeframe.period, f())
[p2, v2] = security(exchange_symbol2 +':' + symbol_in2 + "USDT", timeframe.period, f())
swap_price = p1/p2

plot(swap_price, title="Swap")

h0 = hline(mid, "mid")
h1 = hline(upper, "upper")
h2 = hline(lower, "lower")
fill(h0, h1, color=color.green, transp=85, title="upper area")
fill(h0, h2, color=color.red, transp=85, title="lower area")