“Procrastination has been called a thief,–the thief of time. I wish it were no worse than a thief. It is a murderer.”
Every Forex trader should live by this quote from William Nevins. Your opportunities deteriorate with every second that you delay making a decision. Traders that have access to real-time data have a huge advantage over the rest of the market.
There are some premium tools on the market, but you don’t need to invest in them. You can export real time data from Yahoo! Finance for free. I found a great VBA script that can do this for any currency pairs that you are trying to track.
Using Yahoo! Finance to Get Real-Time Forex Data
Many Forex traders use Yahoo! Finance to monitor currency prices. Unfortunately, the site isn’t perfect. The biggest limitation of Yahoo Finance! is that prices aren’t listed in real time, but Joshua Radcliffe has created a VBA script that gets around that. Here are some steps to use it to get real-time prices on currency pairs.
- Open up Microsoft Excel
- Click on the Macros tab and select the View Macros option
- Create a name for your Macro in the box
- Click Create
- Add the code listed at the bottom of this section into the code editor
- Change the values in currency 1 and currency 2 to the currency pairs that you would like to monitor. For example, you could set currency1 = “EUR” and currency2 = “USD” if you want to see the price between the dollar the euro. You can also keep the code as is and reference the values for the currencies in the cells shown in the code. However, my solution is easier if you are following a specific currency pair.
- Click View Macros again to select the Run option
- The real-time data will be shown in cell C9
This script will give you all the real-time data that you need including the market price, the ask price, the bid price, the 1-year target estimate and the beta-coefficient. You can run the program as many times as you would like.
Here is the code that you will need to add:
Sub Macro1()
‘
‘ Macro1 Macro
‘ Provided by Joshua Radcliffe
‘ www.JoshuaRadcliffe.com
Dim currency1 As String
Dim currency2 As String
currency1 = Cells(4, 3).Value
currency2 = Cells(5, 3).Value
Range(“B9:C12”).Select
Selection.ClearContents
With ActiveSheet.QueryTables.Add(Connection:= _
“URL;http://finance.yahoo.com/q?s=” & currency1 & currency2 & “=X”, Destination:=Range(“$B$9”))
.Name = “q?s=” & currency1 & currency2 & “=X_1”
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = “””table1″””
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub
I have tested Radcliffe’s code for the CHF/JPY currency pair. The prices are slightly different than those listed on Yahoo! Finance. This shows that Daniel’s script works as claimed.
Applications of this Data
There are a couple of reasons that this data can be useful. First of all, you can use this script to get real time pricing data on your currency pairs. This gives you a significant advantage over traders that are relying on Yahoo! Finance’s charts, because they have a 15-minute lag before prices are updated.
You can also record prices throughout the day and use a variety of Excel tools to observe pricing trends. Run the macro and record the price data in a different cell each time. You can select all of the prices and use them to create a two-dimensional line graph in Excel. If you haven’t used Excel before, simply follow these steps:
- Select the prices in the cell (they should all be organized in a column)
- Click on the Insert tab
- Click on 2D line to create a graph with the data that you selected
- You can copy and paste the various charts that you create into a separate document where you can see them later
You can also run a regression analysis. You will need to go to the Excel options tab and click Analysis Tool Pack. You will then need to select Tools and then click Add –Ins. After you have followed these steps, you can click Regression Analysis from the Data Analysis tab.
You may want to monitor pricing trends near popular trading hours. I would recommend monitoring pricing trends between 8 GMT (3 AM EST) and 9 GMT (4 AM EST), because that is one of the most popular trading times. It will take some discipline to wake up that time every day if you are living in the East Coast on the United States, but every bit of knowledge is worth the sacrifice. You can gather approximately 20 data points during that timeframe to draw a trend line. This will give you a better understanding of the trading behavior of the rest of the community.
If you want to get particularly detailed then you can create separate line graphs for different days of the week. You may need a couple months to collect this data, but it will give you a significant advantage over other traders.
Are There Other Options to Get Real Time Data?
There are other tools available to get real-time price data on currency pairs. However, there are a couple of reasons that I would recommend this VBA program instead.
First of all, you don’t have to pay to use this script. This is a great advantage for beginning Forex traders that don’t want to invest a lot of money.
The script also makes it much easier to observe trends. Most other tools that offer real-time Forex data are streaming tools. They may help you make decisions based on the current trading price, but it can be difficult to copy the data and use it to create line charts.
Overall, I would recommend this script over any of the other real-time Forex tools on the market.
I had been using this. It really works for me.
http://marketxls.com/stock-quotes-in-excel/
Thanks for sharing that link!
Can this script be modified to pull historical prices? If so, how?
Hi Lance,
The code already pulls historical prices.
–Shaun
I had been using MarketXLS for this and it’s great.
http://marketxls.com/stock-quotes-in-excel/
MarketXLS is really great.
They have regular updates and customer support unlike yahoo.
It cost a little but it will definitely save you more time.
yahoo finance just changed their interface and this has stopped working. I figured that what we need to change is the field in .Name but I do not know what to change it to
I don’t see any changes to their interface. Also, it would be very unlikely for them to introduce code breaking changes. Too many people use their API.
My code seems to fall over at
WebTables = “””table1″””
What should i be putting instead? Thanks