joapen projects

Just a place to write

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
// © joapen

study("PROD Currency Exchange","Currency-Xchange",overlay=true)

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

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

An example