Foreign Exchange

October 01 2010 Samir Khan 519
Maple

9

I lived in the UK before making the barely-considered decision to move to Canada.  I still have savings denominated in pounds sterling (all dutifully declared on my Canadian tax return).  Accordingly, I keep a close watch on the GBP-CAD exchange rate so I have some sense of my net worth.

When I arrived in Canada in July 2008, one pound sterling bought $2, down from $2.30 two years before that.  Today, the pound has devalued further and is worth around $1.60.  This gives me a vicarious thrill when I visit my friends and family in the Old Country, and flaunt the mighty Canadian Dollar.

Given my unfettered desire to have Maple quantify all aspects of my life, I wrote a procedure which downloads and plots daily exchange rates for a currency pair over a specified date range.  The bulk of the procedure was simply a ?Sockets call to Oanda.com.

The procedure needs two three-letter currency codes (a list of which can be found here), and two dates (in month/day/year format).  Here’s an example of a call, which plots the trajectory of the British Pound against the Mexican Peso from 23rd January to 23rd October 2010.

 ExchangeRatePlot("GBP","MXN","01/23/10","09/23/10",axis = [gridlines = [color = grey]],
 titlefont= [Helvetica,14], axesfont= [Helvetica,12],labelfont= [Helvetica,12]);


The plot also includes a 20-day moving average (the red line) and Bollinger Bands (the black lines), a tool used by technical traders as buy/sell indicators (along with a host of other markers).  Bollinger Bands give a trading range two standard deviations above and below the moving average, with most movement in this range.  Quite simply, if the exchange rate hits the upper band, it’s likely to fall, and vice versa.  Bollinger bands are most significant in a market that’s trading flat, while in a rising or falling market they follow the general trend.

This plot illustrates the GBP-CAD exchange rate over the past year.

Again, most of the movement is within two standard deviations of the 20-day moving average.  However, it seems I should have changed a few British pounds to Canadian dollars three months ago, when the pound was particularly weak. Financial hindsight has always been one of my strong points.

I have some Yuan remaining from a trip to China several years ago.  Out of interest, I plotted the exchange rate against the US dollar over the last year. 

There's an outlier near Day 90, but that's probably just a mistake in the downloaded data.  At least for the majority of the year, the Chinese government pegged the exchange rate at around 6.84 Yuan to the US Dollar.  However, greater exchange-rate flexibility was announced in June, leading to a weaker Yuan and greater volatility. I might have missed the boat on changing GBP to CAD, but now might be the time to change my remaining Yuan into US Dollars.

The worksheet can be downloaded here: Forex.mw

Please Wait...