1597 visualizzazioni
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.
Cheers.
PS Curious that this kind of indicator is not yet on tradingview, at least I could not find anything similar. Do you know any?
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.
Cheers.
PS Curious that this kind of indicator is not yet on tradingview, at least I could not find anything similar. Do you know any?
Commenti
Wish I could get access to this code and try to play with it a bit! Buy awesome job!
I don't remember why I set it as private, I was probably playing around with settings.
Anyway, here it is, enjoy :)
//@version=4
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
myStoch(base)
Calc_dir(sec) =>
base = usd / security(sec, timeframe.period, close)
myStoch(base)
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)
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!
200 * (x - lowest(x, len)) / (highest(x, len) - lowest(x, len)) - 100
base = security(sec, timeframe.period, close) / USD
myStoch(base)
base = usd / security(sec, timeframe.period, close)
myStoch(base)
Copying and pasting the code broke the indentation.