Currency Strength Meter (by vitelot)

This script estimates the relative strength of forex major currencies.
It works in any timeframe with no input required.
The only parameter is used to smooth the curves and can be set to 1 to have the original, but noisy, signals.

Comments are welcome, and please push the like button if you find it useful.


PS Curious that this kind of indicator is not yet on tradingview, at least I could not find anything similar. Do you know any?
Script protetto
Questo script è pubblicato con codice protetto, ma puoi comunque usarlo gratuitamente. Mettendolo tra i preferiti potrai applicarlo al grafico, senza però la possibilità di visualizzare o modificare il codice sorgente.
Vuoi usare questo script sui tuoi grafici?


Hi! Thanks for the great indicator.
I wonder if you could add currency labels on the right side of every currency line?
That would be very helpful.
Thank you!
A great piece of code! Thank you so much!
Wish I could get access to this code and try to play with it a bit! Buy awesome job!
vitelot kasika62
@kasika62, thank you!
I don't remember why I set it as private, I was probably playing around with settings.
Anyway, here it is, enjoy :)

study("Currency Strength Meter (by vitelot)", shorttitle="CSM")
//len = input(200, title="Length")
len = 200
smt = input(5, title="Smoothing EMA period", minval=1)

usd = security("DXY", timeframe.period, close)

myStoch(x) =>
200 * (x - lowest(x, len)) / (highest(x, len) - lowest(x, len)) - 100
Calc_inv(sec) =>
base = security(sec, timeframe.period, close) / usd
Calc_dir(sec) =>
base = usd / security(sec, timeframe.period, close)

sigEur = ema(Calc_inv("EURUSD"), smt)
sigGbp = ema(Calc_inv("GBPUSD"), smt)
sigAud = ema(Calc_inv("AUDUSD"), smt)
sigNzd = ema(Calc_inv("NZDUSD"), smt)
sigJpy = ema(Calc_dir("USDJPY"), smt)
sigCad = ema(Calc_dir("USDCAD"), smt)
sigChf = ema(Calc_dir("USDCHF"), smt)

sigUsd = ema(myStoch(usd), smt)

plot(sigUsd, title="USD", color=#ffffff, linewidth=4)
plot(sigEur, title="EUR", color=#00ffff, linewidth=3)
plot(sigGbp, title="GBP", color=#ff0000, linewidth=3)
plot(sigJpy, title="JPY", color=#ffff00, linewidth=3)
plot(sigCad, title="CAD", color=#ff00ff, linewidth=3)
plot(sigAud, title="AUD", color=#007fff, linewidth=2)
plot(sigNzd, title="NZD", color=#ff7f00, linewidth=2)
plot(sigChf, title="CHF", color=#ff007f, linewidth=2)
kasika62 vitelot
@vitelot, Thank you so much for responding and sharing the code! I really do appreciate. Stay blessed!
I did try to run the code but it gives me an error on line 10 as follows,

Add to Chart operation failed, reason: line 10: Mismatched input '200' expecting 'end of line without the line continuation'.

Could you possibly advise what I can do to solve this? Thank you so much!
vitelot kasika62
@kasika62, you need to indent these lines because they are in their respective functions:

200 * (x - lowest(x, len)) / (highest(x, len) - lowest(x, len)) - 100

base = security(sec, timeframe.period, close) / USD

base = usd / security(sec, timeframe.period, close)

Copying and pasting the code broke the indentation.
KasikaBoss vitelot
@vitelot, Thank you so much! That helped!
Hi! great work man!

I'm also trying to add coding to make custom signals and facing the same issue,
Can you maybe open the script so we can copy it without this issue?

Many thanks!
vitelot Yonatan_Zagron
@Yonatan_Zagron, Hi, I posted it in a comment above ...
I saw that, but didn't manage to make it work
Home Screener azioni Screener forex Screener cripto Calendario economico Su di noi Caratteristiche Grafico Costi Invita un amico Regolamento Centro di supporto Soluzioni per broker & siti web Widget Librerie grafiche Libreria grafica leggera Blog & Novità Twitter