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...
ATM Wiki
Default Broadcast Settings
There are 4 default Broadcast Settings:
- All messages show up through a popup-notifier. This shows up temporarily, for 30 seconds (setting on the Options window).
- All messages show up as an icon in the system tray. The icon shows permanently, or at least until you click it.
- Error messages are sent to us via Notify.io, but only if you said that was okay when you created the settings file.
- "Settings File Opened" messages are sent to us via Notify.io, but only if you said that was okay when you created the settings file.
Deleting or changing these defaults
Deleting / enabling / disabling these 4 default Broadcast Settings is fine. They are normal Broadcast Settings just as if you had created them.
If you did not give us permission to send ourselves the error messages or "settings file opened" messages, you might be surprised to see those Broadcast Settings there. But rest assured they would be disabled. Feel free to delete them if you want.
Scheduled Processes
Scheduled process run from the Command Centre. Some run at recurring intervals of your choosing, such as every minute, every 5 minutes, every 30 seconds, every 24 hours, or whatever. Others are "streaming" in that it's more like flicking a light switch on or off.
These scheduled processes do various things. Some download price bars from a broker, some create price bars, one kicks off automated trading, another alerting, another downloads events from the Forex Factory calendar and converts them to holidays. And so on.
Scheduled processes for downloading price bars
There are streaming downloads, recurring downloads, special recurring downloads, backfills, and historical prices.
Streaming downloads lets ATM receive prices from the broker as soon as the broker sends them. The brokers are always broadcasting the new prices, and by turning on the streaming process what you're telling ATM to do is log in to that broker and start saving the prices it receives. Mostly brokers offer tick prices in this way, and then you would need to also run the recurring process for that broker that creates price bars.
Recurring downloads lets you grab a few bars at regular intervals. Special recurring downloads target only those price bars that are needed for trading systems that are auto-trading right then at that time (and active alerts).
Backfill refers to trying to get price bars you might have missed, had your computer been turned off, disconnected from the internet, or crashed.
Historical prices are those going back potentially many years.
Not all brokers offer all options. But yet there are all of these scheduled processes for all the brokers. The ones that don't actually work have an explanatory note, telling you what to use instead. If having those that don't work still appear in the list is a bit strange, you can filter the list to only those that can be run.
Messaging Overview
ATM is automated trading software. Often you'll start it and go and do other things. But yet you will probably also want to be alerted when important events happen. ATM gives you a variety of ways to be notified.
What you do is create Broadcast Settings (Admin > Broadcast Settings). This is where you tell ATM what kind of messages you want to be notified of, and how you want to be notified. For example, you may choose to be notified by email for all kinds of messages. And, in addition, you want any error messages to be sent to your phone.
With the appropriate Broadcast Settings in place, you then just go about your business using ATM as normal. Backtesting, automated trading, alerts, etc, send out messages, and these messages are broadcast (or not) as per the Broadcast Settings.
To your email address
Email messages can be sent to any email address.
However, you have to first set up an email address to be used as the sending address. That is, the address that goes in the "From:" field. And this sending address must be a Gmail account (from Google). Read more here.
Gmail allows 500 messages to be sent per day from a single account. If we simply used our Gmail account to send the messages, we can reach 500 messages easily. But everyone using their own Gmail accounts would make it very difficult to reach 500.
To notification handlers
There are a couple of free notification handlers out there which aim to standardise your messaging experience. The theory is that other software sends their messages to these handlers, and the handlers show them to you on your computer, or not, or send the messages to you (via email, SMS, etc), or not, based on your settings.
In short, you can get ATM to send messages to these notification handlers, and the handlers work out what to do with the messages based on your settings.
Growl
Mac users will be very familiar with Growl, which has a Windows equivalent suitably called Growl For Windows. From their website:
Growl gives you full control over how you are notified and what action (if any) you want to take in response to the notification. You can choose to be alerted with a visual indicator or an audible alert, both, or neither. You can choose the type of display that is shown, whether the display remains on the screen, the importance of the notification, and even if the notification should be forwarded to another computer. You can have notifications that trigger an email, run a script, launch a program, or are read out loud.
Snarl
Snarl is very similar to Growl. It's up to your personal preference as to which you install. No harm in using both.
Notify.io
Notify.io is another notification handler, but is slightly different in that you don't need to install anything on your computer. Rather you just create an account on the Notify.io website. (Be warned that at time of writing, Notify.io was in the alpha stages of development).
To your mobile/cell phone
There are two different SMS providers (or "gateways") that can be connected to directly by ATM. One is free with limited coverage, and the other (Clickatell) is not free but covers most of the planet. It's pretty cheap though. See here for more info.
In addition, there is at least one more SMS provider available indirectly. You can get ATM to send messages to Notify.io, and in your Notify.io account you can set up TextAuth as your SMS "outlet". Messages would be sent from ATM > Notify.io > TextAuth > your mobile/cell phone. Most likely there are other options available through Growl and/or Snarl.
And that's just the possibilities for traditional SMS messages. ATM can also connect to Notifo, which can push messages to your iPhone, Android or Blackberry.
Via Twitter
Twitter has 2 kinds of messages - tweets and direct messages (DMs). Tweets are public for all to see. DMs go to an individual and are similar to email. However, DMs only work for people that are already following you. Luckily, you can DM yourself (and we imagine this is how people would use Twitter for notifications).
Other
If you are normally in front of your computer, the popup-notifier and/or icon in the system tray might be of use.
Setup Instructions
Some broadcast methods need a sending address, some need the receiver to first "allow" them to send messages, and so on. Setup instructions are all on the "Messaging" tab of the Options window (Admin > Options).
See also:
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.
Getting Started
We guess that if you are using ATM then you have one or more of these goals in mind. Follow the links...
- Download historical prices, e.g. from FXCM - video #1, video #2, wiki
- Load historical prices from text files, e.g. from Gain Capital - video, text tutorial, wiki
- Backtest - video, wiki
- Price and Indicator-based alerts - wiki
- Automated trading - wiki
And some other things which aren't end-goals themselves, but which feed into some of the above:
Video: Creating A Custom Indicator
This tutorial demonstrates how to create a custom indicator, which is then charted.
It assumes:
- You started ATM and opened a settings file.
- That settings file already has some price bars in it.
- ATM is sitting there ready to go.
This tutorial does these things:
- Charts some price bars.
- Adds an indicator to the chart - the LOW minus 0.3%
- Creates a custom indicator implementing the Chandelier Stop.
- Adds the Chandelier Stop indicator to the chart.
It's probably better NOT TO WATCH this video tutorial if you are new to ATM, and especially if you're not good with computers. Custom indicators are the hardest things to understand, and you are totally going to get the wrong impression about this software. ATM comes with a whole number of pre-made custom indicators, so most likely you will not need to create one of your own.
On the other hand, if you can understand this then the rest of the software will be a cinch.
Click here to watch the video, and use the browser's back button to come back. Or click here to open in a new window.
Video: Backtesting
This tutorial demonstrates how to create a trading system, and then backtest that system using historical price bars.
It assumes:
- You started ATM and opened a settings file.
- That settings file already has some price bars in it.
- ATM is sitting there ready to go.
This tutorial does these things:
- Creates a trading system.
- Creates a backtest configuration entry.
- Runs the backtest.
- Views the chart. We decide how the system might be made better.
- Edits the trading system.
- Runs the backtest again.
- Views the chart again to see if we did actually make it better or not.
There are several objective ways of determining if a price is trending or ranging, and the trading system we create in this tutorial was inspired by the Two Bollinger Bands method. For a stop loss we use the Chandelier Stop described in more detail here.
Click here to watch the video, and use the browser's back button to come back. Or click here to open in a new window.
See also:
Video: Loading Text Files And Creating Price Bars
This tutorial starts from a brand new settings file, loads a text file of historical tick prices, creates price bars from those ticks, and charts the price bars. The file in question was obtained from Gain Capital, but the theory is the same for text files from any source.
Note, however, that the file we used in this particular case was an older one. Gain Capital's newer files are slightly different. See the settings to use on the File Loader window.
This tutorial assumes:
- You started ATM, created a new settings file, opened it, and ATM is sitting there ready to go.
- You downloaded some text files containing historical prices.
This tutorial does these things:
- Loads the historical tick prices from the files.
- Creates 10-Minute bars from the ticks.
- Creates Hourly bars from the 10-Minute.
- Charts the 10-Minute bars.
A very similar process is described (in words) in this post.
Click here to watch the video, and use the browser's back button to come back. Or click here to open in a new window.
See also:
Video: Downloading Historical Prices From FXCM (Reverse Order)
This tutorial starts from a brand new settings file and goes through to downloading historical prices from FXCM.
It assumes:
- You installed the FXCM bits when you installed ATM.
- You started ATM, created a new settings file, opened it, and ATM is sitting there ready to go.
- You used this information to go and open an FXCM demo account, and also you logged in to that account using the FXCM trading platform and got your account number.
In this tutorial:
- Try to download prices, but realise you need to create a Data Manager entry first.
- Try to create a Data Manager entry, but realise you need to create a User first.
- Enter the FXCM demo user and account details.
- Create the Data Manager entry for EUR/USD, Daily, FXCM.
- Start the download.
This is the opposite order to that demonstrated in this video tutorial. But actually the method on this current page is more intuitive and also works out to be a bit quicker.
Anyway... let's download some EUR/USD Daily bars...
Click here to watch the video, and use the browser's back button to come back. Or click here to open in a new window.
See also:
Video: Downloading Historical Prices From FXCM
This tutorial starts from a brand new settings file and goes through to downloading historical prices from FXCM.
It assumes:
- You installed the FXCM bits when you installed ATM.
- You started ATM, created a new settings file, opened it, and ATM is sitting there ready to go.
- You used this information to go and open an FXCM demo account, and also you logged in to that account using the FXCM trading platform and got your account number.
This tutorial does these things:
- Enters the FXCM demo user and account details.
- Creates the Data Manager entry for EUR/USD, Daily, FXCM.
- Starts the download.
We, as creators of the software, know the pre-requisites and create them first. However, a normal person just knows that they want to download prices, so they might try that first without entering any of the pre-requisite information. There's a sister video tutorial doing it that way as well.
Ok, so... let's download some EUR/USD Daily bars...
Click here to watch the video, and use the browser's back button to come back. Or click here to open in a new window.
See also:
Example Alerts
Actually there are three kinds of alerts. But trading alerts are triggered by trading systems. This post is about indicator-based alerts and price-based alerts. They are both made through "Automate..." > "Price & Indicator Alerts...".
Indicator-based Alerts
You can have as many alerting rules as you like. Normally all of them have to be true for an alert to fire, but you can use "Groups" to set up optional alerting rules.
A simple example - send a notification when all of these are true:
- Line 1 is above X, where Line 1 is "ADX", and X = 25
- Line 1 is below X, where Line 1 is "RSI", and X = 30
- Line 1 is above Line 2, where Line 1 is the CLOSE, and Line 2 is SMA(10)
- Line 1 is above Line 2, where Line 1 is SMA(10), and Line 2 is SMA(50)
Put a tick in the "use completed bars only" box.
Price-based Alerts
For example, you want to be notified when the EUR/USD price goes above 1.2345:
- Line 1 is above X, where Line 1 is the CLOSE, and X = 1.2345
Remove the tick from the "use completed bars only" box. In this case it doesn't matter what interval you use (5-Minutes, Daily, etc). Because we are using incomplete bars, the CLOSE of all incomplete bars should theoretically be the same. That is, the close of the incomplete 5-Minute bar should be the same as the close of the incomplete Hourly bar.
Wiggle Room
Wiggle room is the technical term *ahem* for the distance between the current price and the stop loss price.
Even in strong uptrends, the price will often fall a bit before continuing up. That's known as a pullback, and pullbacks are immediately obvious after the price has continued its upward journey. In real-time though, while the price is currently going down, is that a pullback, or reversal? There is no way to know.
This has implications on where we put the stop loss. We need to both:
- Keep the stop loss far enough away so that these little pullbacks have enough room to move before the price resumes its upward journey; and
- Keep the stop loss close enough so that we keep as much as the profit as possible if this is an actual reversal and a downtrend begins.
How much wiggle room you give the price is a balance between these two objectives. And that's how charting the backtest results can improve your results - the amount of wiggle room is clearly visible and you will be able to tell if you are placing the stop loss too close or too far away.
%b System #1 With Chandelier Stop
This is the same as %b System #1 except we replaced the trailing stop with the Chandelier method. I've heard of the Chandelier stop before in Dr.Alexander Elder's "Come Into My Trading Room". I came across it again in the Oanda forums, specifically this post.
Here's what a user called EZCurrency said (HHV = highest high value, LLV = lowest low value, ATR = average true range):
For a trailing stop for a long, I use HHV(H,24)-3.5*ATR(24) on an hourly chart. This is the highest high value of the past 24 hrs, then subtract 3.5 times the average range of the past 24 hrs. This accounts for the volatility. Plot it and you will see it is an excellent trailing stop for most pairs!
Another user, Gouranga, then came up with a possible improvement:
One can combine this with a LLV(n) (eg. Long Trade) and take the higher trailer of the two. LLV(n) trailer locks in profit when market consolidates. While (HHV - ATR) locks in profit when market trends. So, you get the best of both mkt conditions.
We provide both of these indicators in ATM - what is described in the first quote is referred to as the "Chandelier Stop", and that described in the second quote is referred to as the "Better Chandelier Stop" (whether it is actually better or not is subject to some backtesting).
But this is a good time to demonstrate exactly what happens when you enter more than one value, so forget that we made the "Better Chandelier" for a second. What ATM will do with the trading system below, for the longs anyway, is calculate both the Chandelier Stop and the lowest low. Then it will take the higher of those two values. For shorts it will take the lower of the Chandelier Stop and the highest high.
The basic theory of using the ATR in order to calculate the stop loss, is that it's adaptive to the current market conditions. During volatile periods the stop will be placed further away, and during less volatile periods the stop will be brought closer to the current price. Basically it adjusts the amount of wiggle room based on the volatility.
In very rough testing, we used 5-Minute bars, 720 for the Bollinger period, which is kind of big, and the normal 2 standard deviations above and below. The period for the ATR is 24.
| Direction | Rule Type | Rule Family | Line 1 | X / Line 2 |
| Long | Entry Rules | Line 1 is below X | Bollinger %b | 0.1 |
| Entry Values | Price where %b would equal X | 0.1 | ||
| Initial S/L Values | Long Chandelier Stop | |||
| Initial S/L Values | Minimum(LOW, 24) | |||
| S/L Mgmt Rules #1 | Line 1 is above X | CLOSE | 0 (zero) | |
| S/L Mgmt Values #1 | Long Chandelier Stop | |||
| S/L Mgmt Values #1 | Minimum(LOW, 24) | |||
| Short | Entry Rules | Line 1 is above X | Bollinger %b | 0.8 |
| Entry Values | Price where %b would equal X | 0.8 | ||
| Initial S/L Values | Short Chandelier Stop | |||
| Initial S/L Values | Maximum(HIGH, 24) | |||
| S/L Mgmt Rules #1 | Line 1 is above X | CLOSE | 0 (zero) | |
| S/L Mgmt Values #1 | Short Chandelier Stop | |||
| S/L Mgmt Values #1 | Maximum(HIGH, 24) |
%b System #1
Bollinger %b is a single line whose value is determined by where the closing price is in relation to the upper and lower Bollinger lines.
When the close is exactly at the lower line, %b equals 0. Below the lower line, %b is negative. When the close is exactly at the upper line, %b equals 1. When it's exactly in the middle, %b equals 0.5. And so on.
It's very rare for %b to be lower than -0.3, or higher than 1.3.
The way Bollinger Bands are constructed, the price moves from the lower band, to the upper band, and back to the lower band. The problem is that the Bands aren't static. Just because the price moved from the lower band to the upper band, it doesn't necessarily mean that the price is rising - the upper band might have come down to meet the falling (or stagnating) price.
Anyway, here's a system which attempts to use this knowledge. In very rough testing, we used 5-Minute bars, 720 for the Bollinger period, which is kind of big, and the normal 2 standard deviations above and below.
| Direction | Rule Type | Rule Family | Line 1 | X / Line 2 |
| Long | Entry Rules | Line 1 is below X | Bollinger %b | 0.1 |
| Entry Values | Price where %b would equal X | 0.1 | ||
| Initial S/L Values | CLOSE * 0.997 | |||
| S/L Mgmt Rules #1 | Line 1 is above X | CLOSE | 0 (zero) | |
| S/L Mgmt Values #1 | CLOSE * 0.997 | |||
| Short | Entry Rules | Line 1 is above X | Bollinger %b | 0.8 |
| Entry Values | Price where %b would equal X | 0.8 | ||
| Initial S/L Values | CLOSE * 1.005 | |||
| S/L Mgmt Rules #1 | Line 1 is above X | CLOSE | 0 (zero) | |
| S/L Mgmt Values #1 | CLOSE * 1.005 |
We know that the price oscillates between one of the outer Bollinger lines and the other. So when the price falls down near the bottom one, we set a trap waiting for it to start heading back to the top one. When the price does start rising again, the limit order is taken up, and a trailing stop loss is kept at 0.3% below the close.
That's setting the stop loss pretty close to the price, but we were using 5-Minute bars which don't need as much wiggle room as Daily bars would.
Similarly, when the price rises up near the upper Bollinger line, we set our trap this time waiting for it to come down.
Maoxian Trading For Dummies With Trailing Stop
This adds a trailing stop to Maoxian's Trading For Dummies system. (One of) his trailing stop techniques is described in the very last paragraph of this page:
One simple way to trail a stop is to place it below the last "up" bar... an "up" bar is simply a bar with a higher high and a higher low than the previous bar.
| Direction | Rule Type | Rule Family | Line 1 | X / Line 2 |
| Long | Entry Rules | Line 1 is equal to Line 2 | VOLUME | MAX(VOLUME, 20) |
| Entry Rules | Line 1 is above Line 2 | Upper Bollinger Line (10, 2) | Upper Bollinger Line (50, 2) | |
| Entry Rules | Line 1 is falling | HIGH | ||
| Entry Rules | Line 1 is above Line 2 | CLOSE | EMA(20) | |
| Entry Rules | Line 1 is below X | Hours part of the bar's start date | 13 | |
| Entry Values | HIGH | |||
| Initial S/L Values | LOW | |||
| S/L Mgmt Rules #1 | Line 1 is rising | LOW | ||
| S/L Mgmt Rules #1 | Line 1 is rising | HIGH | ||
| S/L Mgmt Values #1 | LOW | |||
| T/P Mgmt Rules #1 | Line 1 is above X | Hours part of the bar's start date | 17 | |
| T/P Mgmt Values #1 | Exit At Market | |||
| Short | Entry Rules | Line 1 is equal to Line 2 | VOLUME | MAX(VOLUME, 20) |
| Entry Rules | Line 1 is below Line 2 | Lower Bollinger Line (10, 2) | Lower Bollinger Line (50, 2) | |
| Entry Rules | Line 1 is rising | LOW | ||
| Entry Rules | Line 1 is below Line 2 | CLOSE | EMA(20) | |
| Entry Rules | Line 1 is below X | Hours part of the bar's start date | 13 | |
| Entry Values | LOW | |||
| Initial S/L Values | HIGH | |||
| S/L Mgmt Rules #1 | Line 1 is falling | HIGH | ||
| S/L Mgmt Rules #1 | Line 1 is falling | LOW | ||
| S/L Mgmt Values #1 | HIGH | |||
| T/P Mgmt Rules #1 | Line 1 is above X | Hours part of the bar's start date | 17 | |
| T/P Mgmt Values #1 | Exit At Market |
Objective Ways Of Determining Trending Vs Ranging
How often have you heard "the trend is your friend"? Or "always trade with the trend"? Common wisdom has it that knowing the direction of the trend is very important. Moreover, not all indicators work in all trading conditions. Some work very well in trending markets, others work well in ranging markets. The ones that work well in trending markets normally die painful deaths in ranging markets, and vice versa.
So you've got 3 kinds of markets - up, down, sideways. Up and down = trending, sideways = ranging. More volatility = trending, less volatility = ranging. These market conditions are often easy to spot in hindsight with the naked eye. But for automated trading you need objective, measurable, and repeatable rules which work in real-time.
This post hopes to list such indicators. If you know of others or other ways to use them, you are free to edit this wiki entry and add them to the list for the benefit of your fellow traders. Or send us an email and we'll add it for you.
Just as no indicator can give 100% correct trading signals, so to do these indicators sometimes give false readings. You should experiment and backtest to find the best one for you.
Directional Movement Index
+DI, -DI, and ADX are part of the Directional Movement Index group of indicators.
ADX measures the strength of a trend. A larger value means the market is trending; a lower value means ranging. Where is the cut-over point? This depends on the symbol and time-frame you are trading with, so backtest to find the value that works for you. 25 seems like a good starting point. I have also read that below 20 means ranging, above 30 means trending, and values between 20 and 30 are either or none.
+DI and -DI determine the direction. From Investopedia:
When the +DI is above the -DI, prices are moving up, and ADX measures the strength of the uptrend. When the -DI is above the +DI, prices are moving down, and ADX measures the strength of the downtrend.
One Moving Average
If a moving average of decent length (say 20+) is rising, you can say there is an uptrend. If falling then there's a downtrend.
Using one moving average is better than nothing, but if using one is good, surely using two is better.
Two Moving Averages
Use a combination of faster and slower moving averages, say SMA(10) and SMA(50). If the faster average is above the slower, that's an uptrend. If the faster is below the slower, that's a downtrend.
The distance between the 2 averages gives an indication of the strength of the trend. The MACD indicator measures this, so a rising MACD means a stronger trend.
Three Moving Averages
If two moving average is better, maybe using 3 will be fantastic. For example, moving averages of period 5, 10, and 20:
- When SMA(20) is above SMA(10) is above SMA(5) - that's a downtrend.
- When SMA(20) is below SMA(10) is below SMA(5) - that's an uptrend.
- When they are not in that nice order, the market is ranging.
Two Bollinger Bands
Use a combination of a faster and slower Bollinger Bands. While the faster Bollinger Bands are contained within the slower, it's a ranging market. Otherwise it's trending.
Normally in this trend it's just one of the faster Bollinger lines outside the slower. If the faster upper Bollinger line is above the slower, that's an uptrend. If the faster lower Bollinger line is below the slower, that's a downtrend. If it's both, then that price is about to move big time! (Or the price has already done it's big jump and now it's too late. Cest la vie).
Bollinger Bandwidth
A Bollinger Band's two outer lines flare outwards when prices are volatile, and narrow when they aren't. The Bollinger Bandwidth indicator actually measures that distance, so a rising Bandwidth means higher volatility, and that means a higher possibility that the market is trending. Or you could say any Bandwidth value over X is fine. Or perhaps when the Bandwidth indicator is above its moving average.
High-Low Range
The High-Low range gives a value indicating how long a candle is. You can use the average or maximum high-low range - if rising then the bars are getting progressively longer. Longer bars means more volatility.
True Range
The High-Low range checks just 1 bar, whereas the True Range checks a bar and the bar next to it. Again, the average or maximum true range can be used as a measure of volatility.
Ichimoku Kinko Hyo
We added this indicator for a customer but don't really know how to use it yet. Apparently it's good for this kind of thing. Here is Investopedia's explanation. And here is another random link Google gave us.
Maoxian Trading For Dummies
From the Chairman Maoxian website, more particularly one of his archive pages.
On that archive page, he lists quite a number of trades under the "Trading for Dummies, Q&A Series" banner. While he does not specify his trading rules explicitly, I'm pretty sure that the intention of providing all those examples was for you to look at the charts and work out his system.
Here's what I came up with:
- On 30-Minute chart.
- Unusually active (more volume than normal).
- Very volatile. Perhaps a gap.
- Wait for "pullback", which means lower high in uptrend, higher low in downtrend.
- "Uptrend" means prices above EMA. "Downtrend" means prices below EMA.
- Trade must be before lunch-time. The noon bar is the last bar to make calculations off. Otherwise finish for the day.
- Set entry at high of pullback bar (for long trades).
- Set initial stop-loss at low of pullback bar (for long trades).
- If next bar pulls back further, reset entry and initial stop-loss.
- Exit at the end of the day (or could keep half if you want).
- One trade per stock per day only (i.e. don't get back in if stopped out).
Please keep in mind that this system is meant for trading shares. Some adaptation is required to make it usable for trading currency. For example, currency does not have volume. Further, currency trading is 24/7, 5.5 days per week. The rule to stop trading at noon or at the end-of-day needs to be dropped or adapted.
There are also a couple of things which need to be changed into "purely objective trading systems" language. For example "unusually active", and "very volatile".
Unusually active
This applies to the volume. If the system is to trade in forex then just remove this rule. Here are a couple of possibilities for turning "unusually active" into something that a computer can use:
- Current bar's volume is more than a multiple of the average volume.
- Current bar's volume is the highest of the last 20 bars.
- Rising volume for 2 or 3 bars in a row.
- All of the above combined.
I think I'll go with the second option.
Very volatile
There's a special post about this. I'm going to use the "Two Bollinger Bands" method.
Here's what I came up with:
| Direction | Rule Type | Rule Family | Line 1 | X / Line 2 |
| Long | Entry Rules | Line 1 is equal to Line 2 | VOLUME | MAX(VOLUME, 20) |
| Entry Rules | Line 1 is above Line 2 | Upper Bollinger Line (10, 2) | Upper Bollinger Line (50, 2) | |
| Entry Rules | Line 1 is falling | HIGH | ||
| Entry Rules | Line 1 is above Line 2 | CLOSE | EMA(20) | |
| Entry Rules | Line 1 is below X | Hours part of the bar's start date | 13 | |
| Entry Values | HIGH | |||
| Initial S/L Values | LOW | |||
| T/P Mgmt Rules #1 | Line 1 is above X | Hours part of the bar's start date | 17 | |
| T/P Mgmt Values #1 | Exit At Market | |||
| Short | Entry Rules | Line 1 is equal to Line 2 | VOLUME | MAX(VOLUME, 20) |
| Entry Rules | Line 1 is below Line 2 | Lower Bollinger Line (10, 2) | Lower Bollinger Line (50, 2) | |
| Entry Rules | Line 1 is rising | LOW | ||
| Entry Rules | Line 1 is below Line 2 | CLOSE | EMA(20) | |
| Entry Rules | Line 1 is below X | Hours part of the bar's start date | 13 | |
| Entry Values | LOW | |||
| Initial S/L Values | HIGH | |||
| T/P Mgmt Rules #1 | Line 1 is above X | Hours part of the bar's start date | 17 | |
| T/P Mgmt Values #1 | Exit At Market |
I kept the rules in order of the English description at the start of this post. In this case there is a one-to-one mapping. Except for the last specification - only 1 trade per day. There's no rule in ATM that handles this. But there are the "No Trading" settings. And amongst those there is the "Allow up to and including X long trade(s) in a row" option (also for short). Set these to 1. So one long trade will be allowed, one short trade will be allowed, and then this system will stop trading.
Holy Grail Trading System
This system was found on the Chairman Maoxian website, more particularly at this page.
He credits a book called "Street Smarts", written by Linda Bradford Raschke.
Here's how it is described:
The basic idea for this set-up is that when the Average Directional Index (ADX) is high and price drops back to the 20 period exponential moving average (EMA), you should look to buy and target the previous swing high as your exit.
Obviously this technique can be applied to the short side as well: High ADX, price pulls back to the 20 EMA from below, get short and target the prior swing low.
A bit of tinkering is required to complete this system (in terms of what I think of as a "complete" system). For example, that paragraph uses the words "...you should look to buy..." But when creating purely objective trading systems, a specific value of where to enter needs to be written out.
Here's what I came up with:
| Direction | Rule Type | Rule Family | Line 1 | X / Line 2 |
| Long | Entry Rules | Line 1 is above X | ADX | 25 |
| Entry Rules | Line 1 is above Line 2 | LOW Bar offset 1 |
EMA(20) Bar offset 1 |
|
| Entry Rules | Line 1 is below Line 2 | LOW | EMA(20) | |
| Entry Rules | Line 1 is rising | EMA(20) | ||
| Entry Rules | Line 1 is below Line 2 | HIGH + 0.0010 | Current Bar Swing High | |
| Entry Values | HIGH + 0.0010 | |||
| Initial S/L Values | LOW - 0.0050 | |||
| Initial T/P Values | Current Bar Swing High | |||
| Short | Entry Rules | Line 1 is above X | ADX | 25 |
| Entry Rules | Line 1 is below Line 2 | HIGH Bar offset 1 |
EMA(20) Bar offset 1 |
|
| Entry Rules | Line 1 is above Line 2 | HIGH | EMA(20) | |
| Entry Rules | Line 1 is falling | EMA(20) | ||
| Entry Rules | Line 1 is above Line 2 | LOW - 0.0010 | Current Bar Swing Low | |
| Entry Values | LOW - 0.0010 | |||
| Initial S/L Values | HIGH + 0.0050 | |||
| Initial T/P Values | Current Bar Swing Low |
Actual entry method and stop loss placement methods are not given on the Maoxian webpage. So I chose arbitrary values, as this is just a demonstration anyway. For longs, I put the stop loss 50 pips below the low, and the entry price is 10 pips above the high.
Why that entry point? Because this trading technique is to (I guess) find a good buying opportunity in an established uptrend. So to confirm the uptrend, I make sure that the EMA(20) is rising. And to make sure it's just a minor pullback and not a complete reversal, I put the entry price above the high. So the price has to push higher after initially falling back and triggering our entry rules.
The last thing to note about this system is the placement of the take profit. For longs, the take profit wants to be at the current bar swing high. So I just make sure that this take profit is actually going to be placed above the entry point of high + 10 pips. If not then there's no reason to trade.
Three Ways To Exit
There are 3 ways to exit a trade:
- stop loss is taken out
- take profit is hit
- exit at market
This example will demonstrate all three. For the Longs there will be a stop loss set 50 pips below the low; we will trail that stop loss at 50 pips below the low; a take profit will be set 75 pips above the high; and if we get 2 consecutive lower lows then we will exit at market.
| Direction | Rule Type | Rule Family | Line 1 | X / Line 2 |
| Long | Entry Rules | Line 1 is above X | MACD Histogram | 0 (zero) |
| Entry Rules | Line 1 is above X | RSI | 70 | |
| Entry Values | Enter At Market | |||
| Initial S/L Values | LOW - 0.0050 | |||
| Initial T/P Values | HIGH + 0.0075 | |||
| S/L Mgmt Rules #1 | Line 1 is above X | CLOSE | 0 (zero) | |
| S/L Mgmt Value #1 | LOW - 0.0050 | |||
| S/L Mgmt Rules #2 | Line 1 is falling | LOW Bar offset 1 |
||
| S/L Mgmt Rules #2 | Line 1 is falling | LOW | ||
| S/L Mgmt Value #2 | Exit At Market | |||
| Short | Entry Rules | Line 1 is below X | MACD Histogram | 0 (zero) |
| Entry Rules | Line 1 is below X | RSI | 30 | |
| Entry Values | Enter At Market | |||
| Initial S/L Values | HIGH + 0.0050 | |||
| Initial T/P Values | LOW - 0.0075 | |||
| S/L Mgmt Rules #1 | Line 1 is above X | CLOSE | 0 (zero) | |
| S/L Mgmt Value #1 | HIGH + 0.0050 | |||
| S/L Mgmt Rules #2 | Line 1 is rising | HIGH Bar offset 1 |
||
| S/L Mgmt Rules #2 | Line 1 is rising | HIGH | ||
| S/L Mgmt Value #2 | Exit At Market |
We used the stop loss management rules and values #2 here, but you can use any of stop loss management #1-#9 and take profit management #1, #2 to exit at market.
Using An Overlay For The Entry Price
To keep things simple, normally in these examples we just explain in terms of Long trading. And that will continue here. But also for the purposes of keeping things simple, we also normally just use "Enter At Market" for the entry values - as soon as the entry rules are true, ATM will immediately open a trade using a market order.
ATM can also place limit orders, which allow a slightly different trading style. Here's an example of how they are different:
- open a long trade if the close is above the moving average
- open a long trade as soon as the price hits the moving average
The first style lends itself to market orders. A new price bar comes along, we do the moving average calculation, and if the CLOSE is above that average then we open a trade.
The second style lends itself to limit orders. It's kind of like setting a trap. With the current price below the moving average, we place a long limit order at that moving average. While the current price stays below the moving average, we adjust the order so it stays in-line with the moving average. And if the price ever happens to hit the moving average, our trap is sprung, and the broker will automatically turn our limit order into a trade.
So here's an example of the latter. Our entry price is going to be at the moving average. We will set the stop loss 50 pips below that average, and the take profit 75 pips above.
| Direction | Rule Type | Rule Family | Line 1 | X / Line 2 |
| Long | Entry Rules | Line 1 is below Line 2 | CLOSE | SMA(20) |
| Entry Values | SMA(20) | |||
| Initial S/L Values | SMA(20) - 0.0050 | |||
| Initial T/P Values | SMA(20) + 0.0075 | |||
| Short | Entry Rules | Line 1 is above Line 2 | CLOSE | SMA(20) |
| Entry Values | SMA(20) | |||
| Initial S/L Values | SMA(20) + 0.0050 | |||
| Initial T/P Values | SMA(20) - 0.0075 |
Perhaps you see the moving average as a moving resistance level. If so, you wouldn't care so much that the price hits the moving average - you would see that as normal behaviour. If it was acting as resistance then the price would hit the moving average and bounce off. So you would be more interested in the price breaking through the average. In that case use SMA(20) + 0.0010 (or whatever) for the long entry value - the price would have to break through the moving average by 10 pips for the long limit order to be hit.
Using limit orders to confirm upward/downward pressure
When explaining about the different scenarios that best suit market orders vs. limit orders, we used this one for market orders: "open a long trade if the close is above the moving average".
Limit orders can also be used here. Instead of entering at market whenever the close is above the average, you can set a limit order to confirm upward pressure.
In our example using market orders, a new price bar comes along, we do the moving average calculation, and if the CLOSE is above that average then we open a trade.
But change the entry value to CLOSE + 0.0010 to use a limit order instead. A new price bar comes along, we do the moving average calculation, and if the CLOSE is above that average then we place a long limit order 10 pips higher than the current price. Only if the price continues to rise a further 10 pips does the trade get opened.
Which method works better? Only backtesting knows the answer.
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
3 weeks 4 days ago
3 weeks 4 days ago
6 weeks 3 days ago
7 weeks 3 days ago
7 weeks 3 days ago
7 weeks 3 days ago
7 weeks 3 days ago
7 weeks 4 days ago
7 weeks 4 days ago
9 weeks 6 days ago