RicardoSantos

[RS]Multiple Majors Currency Basket Power Oscillator V1

Power oscillator to discern what currency's are stronger/weaker.
added option to use a smoothed source(close) for pooling the change, giving longer term directional bias, note that this causes lag in the results as MA's turn slower than price.
Remove from Favorite Scripts Add to Favorite Scripts
//@version=2
study(title='[RS]Multiple Majors Currency Basket Power Oscillator V1', shorttitle='P', overlay=false)
USE_TF = input(title='Use Alternative Timeframe?', type=bool, defval=false)
tf = input(title='Alternative Timeframe:', type=string, defval='D', confirm=false)
smooth = input(title='Result Smoothing:', type=integer, defval=1)

src = ema(close, smooth)
eurusd = security('EURUSD', USE_TF ? tf : period, change(src) > 0 ? 1 : change(src) < 0 ? -1 : 0)
eurgbp = security('EURGBP', USE_TF ? tf : period, change(src) > 0 ? 1 : change(src) < 0 ? -1 : 0)
eurjpy = security('EURJPY', USE_TF ? tf : period, change(src) > 0 ? 1 : change(src) < 0 ? -1 : 0)
euraud = security('EURAUD', USE_TF ? tf : period, change(src) > 0 ? 1 : change(src) < 0 ? -1 : 0)
eurcad = security('EURCAD', USE_TF ? tf : period, change(src) > 0 ? 1 : change(src) < 0 ? -1 : 0)
eurchf = security('EURCHF', USE_TF ? tf : period, change(src) > 0 ? 1 : change(src) < 0 ? -1 : 0)

usdeur = 0 - eurusd
usdgbp = security('1/GBPUSD', USE_TF ? tf : period, change(src) > 0 ? 1 : change(src) < 0 ? -1 : 0)
usdjpy = security('USDJPY', USE_TF ? tf : period, change(src) > 0 ? 1 : change(src) < 0 ? -1 : 0)
usdaud = security('1/AUDUSD', USE_TF ? tf : period, change(src) > 0 ? 1 : change(src) < 0 ? -1 : 0)
usdcad = security('USDCAD', USE_TF ? tf : period, change(src) > 0 ? 1 : change(src) < 0 ? -1 : 0)
usdchf = security('USDCHF', USE_TF ? tf : period, change(src) > 0 ? 1 : change(src) < 0 ? -1 : 0)

gbpeur = 0 - eurgbp
gbpusd = 0 - usdgbp
gbpjpy = security('GBPJPY', USE_TF ? tf : period, change(src) > 0 ? 1 : change(src) < 0 ? -1 : 0)
gbpaud = security('GBPAUD', USE_TF ? tf : period, change(src) > 0 ? 1 : change(src) < 0 ? -1 : 0)
gbpcad = security('GBPCAD', USE_TF ? tf : period, change(src) > 0 ? 1 : change(src) < 0 ? -1 : 0)
gbpchf = security('GBPCHF', USE_TF ? tf : period, change(src) > 0 ? 1 : change(src) < 0 ? -1 : 0)

jpyeur = 0 - eurjpy
jpyusd = 0 - usdjpy
jpygbp = 0 - gbpjpy
jpyaud = security('1/AUDJPY', USE_TF ? tf : period, change(src) > 0 ? 1 : change(src) < 0 ? -1 : 0)
jpycad = security('1/CADJPY', USE_TF ? tf : period, change(src) > 0 ? 1 : change(src) < 0 ? -1 : 0)
jpychf = security('1/CHFJPY', USE_TF ? tf : period, change(src) > 0 ? 1 : change(src) < 0 ? -1 : 0)

audeur = 0 - euraud
audusd = 0 - usdaud
audgbp = 0 - gbpaud
audjpy = 0 - jpyaud
audcad = security('AUDCAD', USE_TF ? tf : period, change(src) > 0 ? 1 : change(src) < 0 ? -1 : 0)
audchf = security('AUDCHF', USE_TF ? tf : period, change(src) > 0 ? 1 : change(src) < 0 ? -1 : 0)

cadeur = 0 - eurcad
cadusd = 0 - usdcad
cadgbp = 0 - gbpcad
cadjpy = 0 - jpycad
cadaud = 0 - audcad
cadchf = security('CADCHF', USE_TF ? tf : period, change(src) > 0 ? 1 : change(src) < 0 ? -1 : 0)

chfeur = 0 - eurchf
chfusd = 0 - usdchf
chfgbp = 0 - gbpchf
chfjpy = 0 - jpychf
chfaud = 0 - audchf
chfcad = 0 - cadchf

eur_power = eurusd + eurgbp + eurjpy + euraud + eurcad + eurchf
usd_power = usdeur + usdgbp + usdjpy + usdaud + usdcad + usdchf
gbp_power = gbpeur + gbpusd + gbpjpy + gbpaud + gbpcad + gbpchf
jpy_power = jpyeur + jpyusd + jpygbp + jpyaud + jpycad + jpychf
aud_power = audeur + audusd + audgbp + audjpy + audcad + audchf
cad_power = cadeur + cadusd + cadgbp + cadjpy + cadaud + cadchf
chf_power = chfeur + chfusd + chfgbp + chfjpy + chfaud + chfcad

plot(title='EUR', series=eur_power, color=color(black, 0), linewidth=0)
plot(title='USD', series=usd_power, color=color(maroon, 0), linewidth=0)
plot(title='GBP', series=gbp_power, color=color(navy, 0), linewidth=0)
plot(title='JPY', series=jpy_power, color=color(blue, 0), linewidth=0)
plot(title='AUD', series=aud_power, color=color(teal, 0), linewidth=0)
plot(title='CAD', series=cad_power, color=color(yellow, 0), linewidth=0)
plot(title='CHF', series=chf_power, color=color(red, 0), linewidth=0)
Any suggestions on how to use the Smooth factor ?
Reply
lower == faster reaction and more noise
higher == slower reaction and longer trends
Reply
AB-Trading RicardoSantos
Does that mean a change in the trend will make the indicator lag and is likely to change previous data points ? Is 21 which you are showing in your chart the optimal level to use ?
Reply
the indicator is checking the slope of a ema(X) higher length will create lag. the optimal level depends on what type of trade style you use higher for long trend while shorter for scalping, you can also use both.
Reply
@RicardoSantos thanks for this, could you please tell me how do you insert the currency symbols on the right?

snapshot
Reply
fbatistat PRO fbatistat
What can I do to the code if I just want the symbols?
Reply
@fbatistat, chart options >> scales >> indicator labels

you cant
Reply
fbatistat PRO RicardoSantos
Got it. Thanks very much @RicardoSantos
Reply
I'm testing using 4H with alternative W TF (Smoothing =1), clear signals. Is there any chance that the strategy actually repaints ?
Reply
@AB-Trading, it does if your using any other timeframe besides current because it use close value as a reference, if you want it to not repaint you can edit the script and change its value to open this will make it stop repainting.
at line 7 replace close with open:

src = ema(close, smooth)

to:
src = ema(open, smooth)
Reply
AB-Trading RicardoSantos
@RicardoSantos, Sweet. Will try doing that. Thanks for your help
Reply
Very compliment for your indicator
Is id possible to ad the function:
plot and calculate only on the last N candles
(so it will take less time for loading and calculating)
thanks for attention
Reply
@prabodh, and (I know I'm asking too much) plot only the current pair
Reply
@prabodh, its possible to do the last value only, i supose i can add it ass a feature, will need to check if its possible tho.
Reply
RicardoSantos PRO RicardoSantos
@RicardoSantos, pinescript doesnt supoort this yet.
Reply
United States
United Kingdom
India
España
France
Italia
Polska
Brasil
Россия
Türkiye
Indonesia
日本
한국
Home Stock Screener Forex Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Account and Billing Sign Out