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...
How-To
Command Line Arguments
ATM can be started from the command-line (DOS prompt). All arguments below are optional, except that specifying /scriptargs= without /script= will have no effect. The ordering of the arguments is not important.
Remember that spaces are used to delimit command-line arguments, so if an argument has a space in it then you need to use double-quotes. In fact it's safest just to always use double-quotes.
/file=
When you start ATM normally, it either tries to automatically open the last file you had open, or shows the New File Wizard. If you do not use /file= then ATM reverts to that default behaviour. If you do use the argument then ATM opens the settings file you specify instead.
C:\>"C:\InstallDir\tsatm.exe" /file="C:\User\Bob\Settings File 1.tsatm"
/title=
Prefixes your text to the ATM title (which is normally "Thinking Stuff's ATM vX.Y.Z").
C:\>"C:\InstallDir\tsatm.exe" /title="My ATM 1"
Using the arguments above the title becomes:
My ATM 1 - Thinking Stuff's ATM vX.Y.Z
/script=
Runs a script / executable / batch file of your choosing after ATM has finished opening a settings file.
C:\>"C:\InstallDir\tsatm.exe" /script="C:\SomeDir\SomeProgram.exe"
/scriptargs=
Passes the arguments to the script specified by /script=. But there are some hoops to go through to get the right arguments passed to your script. DOS first parses what you type at the command-line, and then opens ATM with the command-line arguments you give it, and then ATM parses those arguments and forwards anything in /scriptargs= to the script. Here's an example:
C:\>"C:\InstallDir\tsatm.exe" /script="C:\SomeDir\SomeProgram.exe" /scriptargs="arg1 arg2 arg3"
That passes these 3 arguments to SomeProgram.exe:
- arg1
- arg2
- arg3
It's especially important to wrap those script arguments in double-quotes, otherwise only the first one will be treated as an argument to be passed to the script (the other two being considered arguments being passed to ATM due to the spaces).
Scriptargs that contain spaces
For example, you might want to pass a filename that has spaces through as an argument to the script. Now it starts to get a little tricky. This is the wrong way:
C:\>"C:\InstallDir\tsatm.exe" /script="C:\SomeDir\SomeProgram.exe" /scriptargs="arg1 with spaces arg2 arg3"
That passes 5 arguments to SomeProgram.exe:
- arg1
- with
- spaces
- arg2
- arg3
So you might try to wrap "arg1 with spaces" with double-quotes. Like this:
C:\>"C:\InstallDir\tsatm.exe" /script="C:\SomeDir\SomeProgram.exe" /scriptargs=""arg1 with spaces" arg2 arg3"
But that wouldn't work either. Those first two double-quotes in /scriptargs="" would cancel each other out, and much like having no double-quotes at all, only arg1 would make it to SomeProgram.exe.
In this case what you need to do is, while remembering to wrap the entire thing in double-quotes, put a backslash before every double-quote in-between those surrounding double-quotes:
C:\>"C:\InstallDir\tsatm.exe" /script="C:\SomeDir\SomeProgram.exe" /scriptargs="\"arg1 with spaces\" arg2 arg3"
Now 3 arguments will be passed to SomeProgram.exe:
- arg1 with spaces
- arg2
- arg3
All good. Notice those double-quotes don't make it into SomeProgram.exe per se - they are just used to indicate that the first 3 words are all part of the first argument. More than likely "arg1 with spaces" would actually be a filename with spaces, so that's how you'd do it.
Scriptargs that contain double-quotes
First I have to ask, ok, why? But it's possible. And ugly. Luckily this should be a very rare case.
C:\>"C:\InstallDir\tsatm.exe" /script="C:\SomeDir\SomeProgram.exe" /scriptargs="\"arg1 \\"\"with\\"\" spaces\" arg2 arg3"
That's right - you need to type \\"\" for each double-quote that you want to make it into SomeProgram.exe. Here are the arguments that will be passed now:
- arg1 "with" spaces
- arg2
- arg3
%title% and %file%
These two placeholders (or tokens, or whatever) will be converted by ATM into the application title and the settings file full path, respectively, and then passed on to the script. The values used are simply whatever file was opened regardless of method, and whatever application title is visible regardless of it being customised or not:
C:\>"C:\InstallDir\tsatm.exe" /script="C:\SomeDir\SomeProgram.exe" /scriptargs="%file% %title%"
Now the 2 arguments are:
- C:\User\Bob\Settings File 1.tsatm
- Thinking Stuff's ATM vX.Y.Z
(Assuming of course that "C:\User\Bob\Settings File 1.tsatm" is the file opened and you didn't use a custom title).
These placeholders can only be used in the /scriptargs= argument. ATM will put double-quotes around them individually, so you don't need to. But you still need to wrap the entire /scriptargs= setting with double-quotes as per the example above.
Entering this information in the Options window
/file= aside, all of these settings are also available in the Options window in ATM. Two points to note about that:
- If you run ATM from the command line, the arguments above will override the settings in the Options window.
- Entering the values in the Options window is much easier with respect to spaces and double-quotes (because we no longer need to worry about the DOS level of parsing). You don't need to wrap the entire thing in double-quotes. But you do still need double-quotes for arguments with spaces. Forget about the backslashes though:
In DOS prompt: /scriptargs="\"arg1 with spaces\" arg2 arg3"
Field on Options window: "arg1 with spaces" arg2 arg3And to enter an argument which contains a double-quote, now you use the backslash:
In DOS prompt: /scriptargs="\"arg1 \\"\"with\\"\" spaces\" arg2 arg3"
Field on Options window: "arg1 \"with\" spaces" arg2 arg3
%title% and %file% can also be used in the arguments field of the Options window.
Testing
We provide a simple exe file which can use to test your argument settings. Located in the ATM installation directory is a sub-directory called "testargs". In there you will find a file called TestArgs.exe. All that file does is show a message telling you the arguments you passed to it.
Set the script to that TestArgs.exe file, and play around with your argument settings until you get it right. Then change the script to be the actual script you want to use.
TestArgs.exe was written using AutoHotKey (AHK). TestArgs.ahk, also in the testargs sub-directory, is the AHK code. It's mostly a direct copy-paste from an example in the AHK help file.
Why would you want you want to do any of that?
See automating ATM.
- Login to post comments
Obtaining And Using Historical Prices From DukasCopy
The files are available at http://freeserv.dukascopy.com/exp/. Also www.dukascopy.com/swiss/english/data_feed/csv_data_export/.
But you can't start the downloading of all the files and go and do other things - you have to export the data you want one-by-one. Scroll about 4/5 of the way down to get to the currencies available. They have |f| next to them. You can choose any format you like, but make sure you choose "Windows" in the "End line" field.
The good part is that they have data going back to 1986 for some currencies.
DukasCopy provides indicative data, which has no spread. During backtesting, make sure you add on a few pips in the "Commission" field to simulate the spread, otherwise your backtesting results will be overly optimistic.
The Currency Secrets website has covered the issue of indicative data in some depth, so I point you to their pages:
p.s. I think their conclusion is that as long as you add the spread, it should be ok.
I guess it's always better to use the prices from the broker you are going to use, if possible.
Once they are finished downloading, follow the rest of the instructions to load text files. DukasCopy historical prices are already in price bar format though. So you don't need to do the steps to create price bars, unless you want to create other price bars not provided by DukasCopy.
- Login to post comments
Loading Text Files And Creating Price Bars
The method described below works the same for any symbol/interval/broker. We will use the example of creating EUR/USD Hourly and Daily price bars from historical tick prices provided by Gain Capital.
These steps assume you have already downloaded the text files containing the historical prices to your computer. See here for instructions for:
Create the Data Manager entries
Here's a good explanation of what Data Manager entries do.
1. Create a Data Manager entry to store the tick prices
1a. In ATM, click "Price Data" > "Price data configuration"
1b. Click "Add"
1c. In the top box, choose EUR/USD, Tick, Gain Capital
1d. In the bottom box, choose the bottom option - "Just set up (or keep)..."
1e. Click OK.
2. Create a Data Manager entry to store the Hourly bars
2a. (Should still have the Data Manager Search window open). Click "Add"
2b. In the top box, choose EUR/USD, Hourly, Gain Capital
2c. In the bottom box, choose the second option - "...shorter time-period..."
2d. Choose "EUR/USD, Tick, Gain Capital" from the list.
2e. Click OK.
3. Create a Data Manager entry to store the Daily bars
3a. (Should still have the Data Manager Search window open). Click "Add"
3b. In the top box, choose EUR/USD, Daily, Gain Capital
3c. In the bottom box, choose the second option - "...shorter time-period..."
3d. Now you have a choice - you can either choose "EUR/USD, Tick, Gain Capital" from the list, just like you did with the Hourly bars. That would mean the Daily bars are also made from the tick prices. Or, you can choose "EUR/USD, Hourly, Gain Capital", to have the Daily bars made from the Hourly. It's up to your preference, but the second option would be far quicker.
3e. Click OK.
Side note #1:
Each Data Manager entry creates a file on your computer which will store the prices. If you look in your file system you should now see 3 new files: gain_32_tk.tsphd, gain_32_1h.tsphd, and gain_32_1d.tsphd, respectively.
Side note #2:
The number 32 is what we call the "FIP ID", or "Financial Product ID". It's a number only useful within the Thinking Stuff world. 32 equates to the currency with symbol "EUR/USD".
Now to get the price history from the text files into the ATM files. To do this, we first create a "file load task", then process the task.
Load the files
4. Create the file load task
4a. Click "Price Data" > "Price history file loader"
4b. Files to load - browse for and select the file(s) to load. Recommend to just choose 1 file if this is your first time.
4c. Fill in the "File format" and "Dates in the file(s)" fields as per these standard settings for your broker.
4d. Price data to be loaded - EUR/USD, Tick, Gain Capital
4e. Click "Add To List"
5. Process the task
5a. Still on the File Loader window, go to "The Task List" tab
5b. Click "Start Loading"
5c. Wait.
6. Confirm the task worked
6a. Go to the "Completed List" tab.
6b. Scroll all the way to the right to see the result - "Success" is good. Anything in the "Error Text" field is bad.
6c. Back to the Data Manager Search window.
6d. Right-click on the "EUR/USD, Tick, Gain Capital" entry. A little pop-up menu appears. Choose "Table Information (row count, etc)"
6e. The message that shows up should display a count greater than zero.
So now we have the tick prices. What comes next is creating the Hourly and Daily price bars. This time we create "interval creation tasks", then process the tasks.
Create the price bars
7. Create the interval creation tasks
7a. (Should still have the Data Manager Search window open). Click (normal left-click) on the "EUR/USD, Hourly, Gain Capital" entry to highlight it.
7b. At the bottom of that window, go to the "Bulk Price Bar Creation" tab.
7c. Click "Add To List"
7d. Click on "EUR/USD, Daily, Gain Capital" to highlight it.
7e. Click "Add To List"
8. Process the tasks
8a. Still on the Data Manager Search window, go to "The Task List" tab
8b. Click "Start Creating Price Bars"
8c. Wait.
9. Confirm the tasks worked
9a. Go to the "Completed List" tab.
9b. Scroll all the way to the right to see the result - "Success" is good. Anything in the "Error Text" field is bad.
9c. Back to the "Price Data Configurations" tab.
9d. Right-click on the "EUR/USD, Hourly, Gain Capital" entry. A little pop-up menu appears. Choose "Table Information (row count, etc)"
9e. The message that shows up should display a count greater than zero. Same for the Daily one.
Cleanse the prices
Not all text files are created equal. Some have minor errors which can throw out your backtesting results. The easiest way to check for these errors is to view the chart. Ridiculous prices are immediately obvious.
10. View the chart
10a. Click "Price Data" > "View charts"
10b. Fill in the search criteria.
10c. Click "Chart"
11. Cleanse the data
11a. If the chart looks fine then you're all done.
11b. If there are extreme spikes in the chart then it's possible there is some erroneous data in the text files. Follow these steps to perform the cleanse.
- Login to post comments
Zooming The Bar Graphs
Sometimes, as here, the bars will overlap:
You can fix this by zooming in, then zooming out. To zoom in, click and drag the mouse anywhere on the chart, to create a rectangle:
What that's done is zoom in to the size of the rectangle. Now right-click, and choose "Un-zoom":
The result of doing that will be something like this:
- Login to post comments
To Send Orders Quickly
The Order window has quite a lot of fields to fill in. Starting from scratch, it's slow and cumbersome when you want to send an order to the broker as quickly as possible. But there are 2 ways you can pounce on a trade if need be:
- Fill in all the details beforehand, and save it. Keep the status at "New". When it comes time to actually place the order with the broker, you can just click "Edit" and send. Even if you have to change some fields then it's just a couple of clicks.
- Copy an existing order that you already sent to the broker. Set the status back to "New". Edit the other fields, send to the broker.
See also:
- Login to post comments
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.
- Login to post comments
To Transfer Data From One ATM File To Another
The files that ATM creates are normal files that you can copy, move, rename, backup, and so on.
Two Very Important Points
Firstly, make sure that ATM is closed before moving any files. Secondly, price history files (the ones ending in .tsphd) have very specific names. You can copy/move them to different folders, but you can't rename them.
Copying an entire setup
The files to copy include 1 settings file, and then zero-to-many price history files. The folder that the price history files are in is shown on the Options tab, in case you forgot where you put them. Full file paths are also shown on the Data Manager Search window.
Copy all those files to the new computer. Start ATM. Go immediately to the Options window. Change the price history file location if necessary (to match where the files are located on the new computer). If you did change it then re-start ATM.
Merging settings files
You can export trading systems, alerts, custom indicators, and charts. The exported files are just text files. Copy them to your other computer and then import. All other settings have to be re-entered manually.
Merging price history files
While you can export price history to text files and then import on the other computer, there are better ways. In the examples below, we will say that we are copying the file containing prices for EURUSD/Hourly/FXCM. This corresponds to a file with name fxcm_32_1h.tsphd:
- If on the second computer you don't have a Data Manager entry for that yet, just copy the file straight to the directory where all the other price history files are. Start ATM, make the Data Manager entry for EURUSD/Hourly/FXCM, and ATM will immediately recognise all of the price history in that copied file.
- If on the second computer you already have a Data Manager entry for that, but haven't gathered any or much price history for it, just delete the Data Manager entry and follow the steps in paragraph #1.
- If on the second computer you already have a Data Manager entry for that, and have already started gathering price history for it (enough to make you feel sad to just delete it and follow the instructions in paragraph #1), then you can use the File Loader window to merge the two .tsphd files. It will go faster if you put the larger file in the directory with all the others, and merge the smaller file.
On the File Loader window, select the file to load, set "order of fields" to "ATM Price History file (*.tsphd)", and choose "EURUSD/Hourly/FXCM" as the price data to be loaded. The File Loader will say that the rest of the fields are mandatory, but they're not in this case and you can choose any value just to get past the mandatory fields check.
Just to repeat, when copying files to or from the computers, make sure ATM is closed.
- Login to post comments
To View The Data Directly In The ATM Files
The settings file and price data files are standard relational databases. Like Microsoft Access files, if you're familiar with that. But Microsot Access has some size restrictions, so instead we use Firebird SQL embedded databases. Same but different. To open these files and peek inside you can grab some freeware (and help documentation) from sqlmanager.net
- Login to post comments
To Customise ATM With 3rd Party Software
This section outlines software written by other people, that you can use (normally free), to alter the way ATM behaves.
You may not need any of these, or in fact you might want to use different software to that listed below. That's fine. In fact if you have any other suggestions or alternatives, we'd appreciate hearing about them.
We have no affiliation with any of the companies that offer the software, we probably can't help you if anything goes wrong with them, and perhaps we aren't even using the software ourselves.
To get ATM to run as a Windows service
A program running as a Windows service has the ability to automatically re-start itself if ever it or the computer crashes. That's why you may want to run ATM as a Windows service.
FireDaemon Pro can turn any program into a Windows service. It costs US$39 (last time we checked)
Troupware's Control Running Programs (CRP) does something similar, in that it ensures another program is always running. This one's free. [Had some problems connecting to the website though, but still available for download from freeware sites].
XYNTService looks like a good option if you're a bit more technically-savvy. It's free and open-source. It has a (separate) GUI interface, and also a version made specifically for Vista and above.
Watchdog (free) might also work. As might Keep-Alive ($39.99, and be warned of a very Geocities-style website).
To have ATM do things as soon as it starts
It's no good to just have ATM start itself again after a crash - presumably you would also want ATM to resume whatever it was doing.
AutoHotKey (AHK) is a free program that you can use to then click the buttons you want clicked - just as if you were doing the clicking yourself. Basically you record a macro. Running the macro then repeats whatever you did (mouse clicks, mouse movements, key strokes, etc) while you were recording the macro.
So a combination of FireDaemon Pro, plus AutoHotKey, lets you setup ATM to recover from crashes all without the need for you to do anything.
DoOver is maybe a simpler alternative. It was actually made using AHK, but you don't need to know anything about AHK to use it.
Sikuli is a recent new alternative which you might find easier than AHK. Instead of recording a macro and maybe editing the macro script it creates, you take screenshots of what you want clicked.
To have ATM minimise to the system tray
There are a bunch of free applications that we know of that can make any program minimise to the system tray:
Minime lets you minimise any software to the one icon in the system tray.
TrayIt!, PowerMenu, Trayconizer.
See also:
- Login to post comments
Free Software For Downloading Big Files
If you're going to download any of the text files containing historical price data from the brokers, there is some free software that is going to make your life a whole lot easier.
downTHEMall!
Especially with Gain Capital, there are *a lot* of files to download. If you do one at a time you'll probably go insane. I used to do it that way until I found a better method. Using a combination of the free Firefox web browser (an Internet Explorer replacement), and a free Firefox extension called downTHEMall!, you can download a month's worth of files with a couple of clicks.
Here are the steps:
- Download Firefox.
- Install Firefox.
- Run Firefox.
- Using Firefox, browse to the downTHEMall! extension page.
- Click on the link that says to "Install Now for Windows".
- When that finishes, close down Firefox.
- Restart Firefox.
Now you're ready to get the historical price data.
Using downTHEMall! also ensures that if you are disconnected for any reason, the download can pick up from where it left off (and not have to re-download the file from the beginning).
Text File Cleaver
Some of the files you download, especially those from Oanda, are huge. The Oanda ones contain around 20 million rows of tick price data, and ATM will probably not be able to load a big file like that in one go because of the database timeout setting on the Options window.
Instead, please use a file-splitting utility such as Text File Cleaver. Using the default options, Text File Cleaver splits the one big file into a number of smaller files, each containing 65,000 rows. ATM can easily process those files individually within the timeout period. For the Oanda file I tested with, 299 smaller files were produced.
The reason for recommending Text File Cleaver (aside from that it's free), is that it keeps each row intact. Other file splitters just split the file after a particular number of characters, which often falls in the middle of a row of price data.
Simply follow this link, scroll down to find the "Text File Cleaver" section, download and install.
- Login to post comments
Recent blog posts
- New Release: v3.0.3 - Everything Except Autotrading
- Mid July 2010 Update
- Start of June 2010 Update
- New Release: v3.0.2 - Copy, better error message, more options
- New Release: v3.0.1 - The Stabilise-ening
- Ah, The First Bug [Fixed in v3.0.1]
- New Release: v3.0.0 - The Rewrite
- Start of February 2010 Update
- End Of 2009 Update
- New Release: v2.0.10





Recent comments
20 weeks 5 days ago
35 weeks 6 days ago
41 weeks 4 days ago
41 weeks 4 days ago
48 weeks 22 hours ago
49 weeks 2 days ago
1 year 4 weeks ago
1 year 4 weeks ago
1 year 6 weeks ago
1 year 11 weeks ago