Forex Multi Exchange Volume
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © john_everist

//@version=5
indicator(title='Multi-Exchange Relative Volume', shorttitle='Multi Exchange Volume', format=format.volume, overlay=true, scale=scale.right)

// Input
choice1 = input.string(title='Volume 1', options=['FXCM', 'OANDA', 'FOREX.COM', 'PEPPERSTONE', 'GLOBALPRIME'], defval='FXCM')
choice2 = input.string(title='Volume 2', options=['FXCM', 'OANDA', 'FOREX.COM', 'PEPPERSTONE', 'GLOBALPRIME'], defval='OANDA')
choice3 = input.string(title='Volume 3', options=['FXCM', 'OANDA', 'FOREX.COM', 'PEPPERSTONE', 'GLOBALPRIME'], defval='FOREX.COM')
choice4 = input.string(title='Volume 4', options=['FXCM', 'OANDA', 'FOREX.COM', 'PEPPERSTONE', 'GLOBALPRIME'], defval='PEPPERSTONE')
choice5 = input.string(title='Volume 5', options=['FXCM', 'OANDA', 'FOREX.COM', 'PEPPERSTONE', 'GLOBALPRIME'], defval='GLOBALPRIME')
ema = input.int(title="EMA", defval=14, options=[3, 5, 7, 10, 14, 20, 50, 100, 200])
len = input.int(title="Backtrack", defval=17)


// Do some minor changes
exchange1 = choice1 == 'FXCM' ? 'FX' : choice1 == 'FOREX.COM' ? 'FX_IDC' : choice1
exchange2 = choice2 == 'FXCM' ? 'FX' : choice2 == 'FOREX.COM' ? 'FX_IDC' : choice2
exchange3 = choice3 == 'FXCM' ? 'FX' : choice3 == 'FOREX.COM' ? 'FX_IDC' : choice3
exchange4 = choice4 == 'FXCM' ? 'FX' : choice4 == 'FOREX.COM' ? 'FX_IDC' : choice4
exchange5 = choice5 == 'FXCM' ? 'FX' : choice5 == 'FOREX.COM' ? 'FX_IDC' : choice5

// Get data
volExchange1 = request.security(exchange1 + ':' + syminfo.ticker, timeframe.period, volume)
volExchange2 = request.security(exchange2 + ':' + syminfo.ticker, timeframe.period, volume)
volExchange3 = request.security(exchange3 + ':' + syminfo.ticker, timeframe.period, volume)
volExchange4 = request.security(exchange4 + ':' + syminfo.ticker, timeframe.period, volume)
volExchange5 = request.security(exchange5 + ':' + syminfo.ticker, timeframe.period, volume)
vol = (na(volExchange1) ? 0 : volExchange1) + (na(volExchange2) ? 0 : volExchange2)+ (na(volExchange3) ? 0 : volExchange3) + (na(volExchange4) ? 0 : volExchange4) + (na(volExchange5) ? 0 : volExchange5)
if(vol == 0)
    vol = volume


// Do calculation



// Set colors
green = #004d40
red = #841515


// Plot volume
plot(vol, color=open < close ? green : red, style=plot.style_columns, title='Volume', transp=10)
plot(ta.ema(vol, ema), color=color.gray, style=plot.style_area, transp = 60)