CapnOscar

USDIndex

345 3 51
Just seeing folks asking a lot about USD INDEX I just wanted to help little bit
Remove from Favorite Scripts Add to Favorite Scripts
// CapnOscar Cheers

study(title="USDIndex", overlay=false)

eusd = security("EURUSD", period, close) // 
usjpy = security("USDJPY", period, close) // 
gbpus = security("GBPUSD", period, close) // 
uscad = security("USDCAD", period, close) // 
ussek = security("USDSEK", period, close) // 
uschf = security("USDCHF", period, close) // 

usdx = 50.14348112 * pow(eusd,-0.576) * pow(usjpy,0.136) * pow(gbpus,-0.119) * pow(uscad,0.091) * pow(ussek,0.042) * pow(uschf,0.036)

plot(usdx, color = red)

thx a lot! would be great if you could modify it to get it the same absolute value as the official USD index. Aka "fix it to the start date". Following could help you (credit to Ricardo Santos) by it as inspiration:

study("My Script"
_day = input(title='day', type=integer, defval=0)
_month = input(title='month', type=integer, defval=0)
_year = input(title='year', type=integer, defval=0)

check_time(_dd, _mm, _yyyy) => _dd == dayofmonth and _mm == month and _yyyy == year ? true : false
sec = security(tickerid, period, valuewhen(check_time(_day, _month, _year), close, 0))
plot(sec)

Reply
Good thinking Batman
+1 Reply
CapnOscar SunnyBTC
was simple solution I thought :)
+1 Reply
United States
United Kingdom
India
España
France
Italia
Polska
Brasil
Россия
Türkiye
Indonesia
Malaysia
日本
한국
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
Profile Profile Settings Account and Billing Priority Support Ideas Published Followers Following Private Messages Chat Sign Out