Alternative currency

Some people have their investments in local currency banks and they are affected by eschange rate. The usual case is people buying US stocks in Euros, and they want to understand the impact of currency exchange on their portofolio.

I have not found any code that does it so I created one.

Configure it

Pick the original and target currency:

 

The code

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © joapen

//@version=4
study("PROD Currency Exchange","Currency-Xchange",overlay=true)

OriginalCurrency = input('USD')
TargetCurrency = input ('EUR')

//currency-exchange
exchange = security(OriginalCurrency + TargetCurrency,timeframe.period,close) //Retrieves last close of the exchange
AlternativeValue = close * exchange //Converts value into the target currency
//output
plot(AlternativeValue)

An example

Leave a Comment