Eight lines in one panel, one per major currency: USD, EUR, GBP, JPY, CHF, AUD, CAD and NZD. Each line is how strong that currency has been against the seven others over the last bars, so the currency on top is the one the market is buying and the one at the bottom the one it is selling, whatever instrument the chart shows.
This code is written in ProRealCode Script and runs with ProRealCode Studio on ProRealTime Web.
Paste the code into a new Studio tab and press Ctrl + Enter. The lookback and the smoothing are fields of the Variables form. It works on any chart; a forex chart in real time shows the moves as they happen. The pairs are read on the chart’s timeframe and joined bar by bar without reading the future.
// ProRealCode Script example — currency strength meter
// Seven forex pairs read with MarketData give the strength of the eight major
// currencies, drawn as eight lines in one panel. A currency's strength is its
// average move against the seven others over the lookback, in %.
DEFPARAM overlay = false
input(len, 20, "Lookback (bars)", int)
input(smooth, 3, "Smoothing (bars)", int)
// Seven pairs against the US dollar, on the chart's timeframe
eurusd = MarketData("EURUSD", default, close, default)
gbpusd = MarketData("GBPUSD", default, close, default)
audusd = MarketData("AUDUSD", default, close, default)
nzdusd = MarketData("NZDUSD", default, close, default)
usdjpy = MarketData("USDJPY", default, close, default)
usdchf = MarketData("USDCHF", default, close, default)
usdcad = MarketData("USDCAD", default, close, default)
// Each currency's move against the dollar over the lookback, in % (log scale)
rUSD = 0
rEUR = LOG(eurusd / eurusd[len]) * 100
rGBP = LOG(gbpusd / gbpusd[len]) * 100
rAUD = LOG(audusd / audusd[len]) * 100
rNZD = LOG(nzdusd / nzdusd[len]) * 100
rJPY = -LOG(usdjpy / usdjpy[len]) * 100
rCHF = -LOG(usdchf / usdchf[len]) * 100
rCAD = -LOG(usdcad / usdcad[len]) * 100
total = rUSD + rEUR + rGBP + rJPY + rCHF + rAUD + rCAD + rNZD
// Average move of one currency against the seven others
FUNCTION strength(r, sumAll)
(8 * r - sumAll) / 7
ENDFUNCTION
usd = Average[smooth](strength(rUSD, total))
eur = Average[smooth](strength(rEUR, total))
gbp = Average[smooth](strength(rGBP, total))
jpy = Average[smooth](strength(rJPY, total))
chf = Average[smooth](strength(rCHF, total))
aud = Average[smooth](strength(rAUD, total))
cad = Average[smooth](strength(rCAD, total))
nzd = Average[smooth](strength(rNZD, total))
// Each line named at its right end
IF islastbarupdate THEN
DRAWLABEL(barindex + 1, usd, "USD", none, small, left) COLOURED(60, 190, 120)
DRAWLABEL(barindex + 1, eur, "EUR", none, small, left) COLOURED(90, 170, 255)
DRAWLABEL(barindex + 1, gbp, "GBP", none, small, left) COLOURED(190, 150, 255)
DRAWLABEL(barindex + 1, jpy, "JPY", none, small, left) COLOURED(240, 90, 90)
DRAWLABEL(barindex + 1, chf, "CHF", none, small, left) COLOURED(230, 230, 235)
DRAWLABEL(barindex + 1, aud, "AUD", none, small, left) COLOURED(240, 180, 60)
DRAWLABEL(barindex + 1, cad, "CAD", none, small, left) COLOURED(255, 120, 170)
DRAWLABEL(barindex + 1, nzd, "NZD", none, small, left) COLOURED(80, 210, 210)
ENDIF
RETURN usd AS "USD" COLOURED(60, 190, 120) STYLE(line, 2), eur AS "EUR" COLOURED(90, 170, 255) STYLE(line, 2), gbp AS "GBP" COLOURED(190, 150, 255) STYLE(line, 2), jpy AS "JPY" COLOURED(240, 90, 90) STYLE(line, 2), chf AS "CHF" COLOURED(230, 230, 235) STYLE(line, 2), aud AS "AUD" COLOURED(240, 180, 60) STYLE(line, 2), cad AS "CAD" COLOURED(255, 120, 170) STYLE(line, 2), nzd AS "NZD" COLOURED(80, 210, 210) STYLE(line, 2), 0 AS "0" COLOURED(110, 110, 120)