Thinking Stuff's ATM

Automated Trading Machine (ATM) makes it simple to remove fear and greed from your trading. Automated trading is no longer just for the rich or nerdy. Our revolutionary software runs on your computer, using your trading rules, but none of your emotions. There's just one requirement - you know how to use a mouse.  Learn more...

Thinking Stuff's ATE

Automated Trading Execution (ATE) is where we run your trading systems for you on our servers. Your system can be exported from ATM, or written in plain English and we'll make it for you. We'll even backtest and suggest improvements if you want us to. This service essentially automates your automated trading.  Learn more...

Thinking Stuff's Groups

Join a group of like-minded individuals, and help each other to trading success. Once you join a group, you will have access to that group's trading systems, ideas, and feedback. And please contribute your own knowledge as much as possible. Or contact us to start your own group.  Learn more...

Oanda

Obtaining And Using Historical Tick Prices From Oanda

[Note: these instructions for Oanda were written a couple of years ago. If you have more recent experience of obtaining their historical prices we would appreciate an update].

Oanda, through the FXTicks tool in their FXLabs section, offers tick data going back to January 1st, 2004. This is for five currencies only though - EUR/USD, GBP/USD, USD/CAD, USD/CHF, USD/JPY.

From the website:

In order to qualify for this service, you must have an FXTrade account with a balance of 1000 USD or more. Data may be ordered as far back as January 1, 2004, and as recently as two (2) months ago.

Steps to obtain the files:

  1. Go to Oanda to order the files.
  2. Fill in the form on that webpage. ATM can handle ASCII Text, CSV, and Pipe-delimited.
  3. Repeat step 2 for all currencies that you want the data for.
  4. Wait up to 2 weeks for Oanda to process your request. When they notify you, they will provide you with a website link to click.
  5. Click the link and download the file. Whether you use downTHEMall! or not is up to you.

Now you have the files downloaded to your computer. But they are huge! Seriously. They are going to be more manageable if you split them into smaller files. That's where Text File Cleaver comes in.

Start Text File Cleaver, select the file to cleave, and select the directory to put the small files in. Click the "Go!" button. Repeat that for each big file you downloaded.

Then follow the rest of the instructions to load text files and create price bars. But on the File Loader window, select the smaller files to load instead of the big file.
 

File Loader Settings

The File format and Dates in the file(s) fields on the File Loader window have standard settings based on where you got the files from. (You could also just look in the file).

By "file formats", I mean how the price data is arranged in the text file. As an example, here's how Gain Capital price data looks like:

277248713,EUR/USD,2006-11-05 17:00:02,1.271600,1.271900,D

Comparing that with one from an Oanda text file, you can see they are completely different:

13/02/04 08:36:34,1.280600,1.280800
 

Gain Capital

 
Older files up to and including 2009/05 May/Week3

Order of fields - ID, Currency, Data, Bid, Ask, "D"
Delimiter - Comma
Ignore first row - No
Date format - yyyy-MM-dd HH:mm:ss
Timezone - New York (GMT-5/-4)
 

Files from 2009/05 May/Week4 up to and including 2009/11 November/Week3

Order of fields - ID, Currency, Data, Bid, Ask, "D"
Delimiter - Comma
Ignore first row - Yes
Date format - yyyy-MM-dd HH:mm:ss
Timezone - New York (GMT-5/-4)
 

Newer files from 2009/11 November/Week4 to present

Order of fields - ID, "D", Currency, Data, Bid, Ask
Delimiter - Comma
Ignore first row - Yes
Date format - yyyy-MM-dd HH:mm:ss
Timezone - New York (GMT-5/-4)
 

Oanda

Order of fields - Date, Bid, Ask
Delimiter - depends on what you requested from Oanda. XML files cannot be used.
Ignore first row - check the file
Date format - dd/MM/yy HH:mm:ss (note only 2-digit year)
Timezone - Greenwich Mean Time (GMT)
 

DukasCopy

Order of fields - Date, Time, Volume, Open, Close, Min, Max
Delimiter - depends on what you requested from DukasCopy
Ignore first row - check the file
Date format - can't remember - you should check the file
Timezone - Greenwich Mean Time (GMT)

Something to be aware of with these files is that there is no spread included. Therefore ensure you use a few pips of commission when backtesting, to try and mimick the spread. If you fail to do so, you're backtesting results will be overly fantastic.
 

ATM price history files (*.tsphd)

Order of fields - ATM Price History File (*.tsphd)
Delimiter - choose any
Date format - choose any
Timezone - choose any

The File Loader has some mandatory fields that aren't actually mandatory in this case. Just choose any value to get past the mandatory field check.

As per this wiki entry, the price history files have very specific names, e.g. fxcm_23_1d.tsphd. The ones being used by ATM (i.e. the ones which correspond to Data Manager entries) cannot be renamed at all. But if you are wanting to merge a price history file with another, most likely it means you got one from somewhere or someone else. This file you can rename, if you are going to use the File Loader window to merge it. But make sure you keep the file prefix intact. That is, add another dot and type after it, e.g. fxcm_23_1d.temp.tsphd or fxcm_23_1d.copy.tsphd.
 

Text files exported by ATM v3+

Order of fields:

  • for files containing tick prices - Date, Utc, FIP ID, Symbol, Bid, Ask, Volume
  • for files containing price bars - Date, Utc, FIP ID, Symbol, Bid OHLC, Ask OHLC, Volume

Delimiter - depends on what the setting was when the file was exported.
Ignore first row - check the file
Date format - yyyy-MM-dd HH:mm:ss
Timezone - choose any

As the date and Utc offset is written into these files, the timezone field is not actually required. So just choose any value to get past the mandatory field check.
 

Text files exported by ATM pre-v3

Order of fields:

  • for files containing tick prices - Date, Currency, Bid, Ask
  • for files containing price bars - Date, Currency, Bid OHLC, Ask OHLC

Delimiter - depends on what the setting was when the file was exported.
Ignore first row - check the file
Date format - yyyy-MM-dd HH:mm:ss
Timezone - Greenwich Mean Time (GMT)
 

Other

ATM supports just about any date format, and any 1-character delimiter. So if you have a text file from somewhere else, all you have to do is somehow get the order of fields to match one of the available options.

If that's beyond your technical prowess, or you know of another popular file format that you think we should support, you can add a post to the feature request forum.
 

Account Numbers

When you create an account in ATM you have to enter an account number. Read below for what to enter, as it differs by broker.
 

FXCM

To find the account number, first log in to the FXCM trading platform. You should be able to see an "Accounts" section, with all your accounts listed there. For a demo account, there's probably only one account listed. Anyway, in that "Accounts" section, there should be an "Account" column. The value in that field is close to, but not the value you want to type into ATM.

First, if the account number has letters at the start, don't type them.

Second, if the account number has zeroes at the start, don't type them.

Third, if the number is longer than 8 digits, only type the last 8 digits.

So an account number like:

  • 0012346 would be entered into ATM as 123456
  • ABC000123456789 would be entered as 23456789
     

Oanda

To find the account number, first log in to the Oanda trading platform. Then from the main menu of that trading platform, click "Account", then choose "Change Account". You should now be able to see a list of your accounts. The number to enter in this field is the number in brackets. E.g. if it says something like "Primary (1234567)", then enter 1234567 in this field in ATM.
 

Gain Capital

Doesn't give out account numbers, so just enter 0 (zero).
 

To Make The Oanda API $400, Not $600

I had on my website that the Oanda API monthly fee should never be more than $200, even if you didn't do any trading for that month. "Ask me how" I said. So somebody asked me how, and I set about doing the exact math to be sure I didn't look like a complete idiot.

Well, it's not $200, it's $400. But it's still not $600, so I'm not a complete idiot, just a partial one :-) *whew, lucky*

Here's what I wrote to that guy:

Firstly, there is no getting around the upfront payment of $600. That buys you 2 months of use, the theory being that you are supposed to use those 2 months to finish off your code and test your software.

Then, after the first 2 months, there is the monthly payment of $600. This is what can be brought down to a maximum of around $400. My website said $200, and that was from a misunderstanding I had. Writing this email forced me to do the figures exactly, so I'm glad you asked.

Also let me say that this strategy is plucked from threads in the Oanda forum, with a guy by the tag of "dgcfx" having been given the credit there.

Now, the monthly fee is discounted by $50 for every US$1 million worth of trades. So, if you buy and sell US$12 million of currency within the month, the API use is free for that month.

My understanding is that one complete trade, both an opening of a position and a closing, a buy and a sell, is considered twice for the volume calculation. Buy $100,000 of USD, then sell $100,000 of USD, and that adds up to $200,000 units of USD for the purposes of the API fee.

So let's take the worst case - that you didn't trade at all during that month. The fee would be the full $600.

Just before the month ends, you work out how much more currency you need to buy in order to build it up to $12 million worth. In the case that you didn't trade at all, obviously you need to buy and sell the full $12 million.

And this is how to get the monthly fee down to around $400 - you buy and sell and buy and sell currency until you reach $12 million worth. So instead of paying the $600 fee, you pay whatever the spread cost you in those trades.

If you have enough money (unlikely for little guys like me), you can buy and sell $12 million in one go. If not, you buy and sell $100,000 of USD 60 times. Or $200,000 worth of USD 30 times. Or whatever.

Let's do the calculations with EURUSD.

At the time of writing, EURUSD ask was 1.2810, with a spread of 1.5 pips.

We want the contract value to be US$6 million or more, so divide 6,000,000 by 1.2810 to see how much EURUSD we need to purchase. 4,683,841 EURUSD.

EURUSD is always US$10/pip for 1 contract (100,000 units), so it would be US$468.38 for 4,683,841 units.

And because the spread is 1.5 pips, the total spread cost using EURUSD would be $702.57. No good.

Now let's try EURDKK.

The thing about EURDKK is that EUR and DKK are highly correlated, so EURDKK hardly moves, so you have little risk of the price moving a great deal (or at all) in between the buying and the selling.

Further, the interest payment is minimal (measured in parts of a cent), even on such large amounts.

At time of writing, EURDKK ask was 7.4604, with a spread of 5 pips.
And USDDKK was 5.8206.

We want the contract value to be US$6 million or more, so multiply 6,000,000 by 5.8206 to see how much DKK we need to purchase. 34,923,600 DKK gets us USD$6m.

And divide 34,923,600 DKK by 7.4604 to see how many units of EURDKK that equates to. 4,681,196 EURDKK.

At these prices, with the spread at 5 pips, and with that much EURDKK, the total cost of the spread is USD$402.58.

I won't go into how I calculated the cost of the spread in this case, but rest assured I confirmed it by placing this trade in my Oanda game account. (Actually I used a third of the volume, and it cost me $134. $134 times 3 = $402).

The original post in the Oanda forums had it costing around $300, but there were posts later on that mentioned Oanda had made the EURDKK spread wider since then, thereby making this tactic more expensive than before.

Remember, $400 is the maximum amount to pay if you didn't do any trades at all for that month. If you use automated trading software, you should theoretically be able to do quite a lot of trading.

I hope that's answered your question. I'm really sorry about not being correct with $200.