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...

Trading systems

Number Of Units To Purchase

Currency brokers normally only allow a certain multiple of units to be purchased at a time. Some brokers allow multiples of 1000, some of 10,000, and there are still some hold-outs mandating multiples of 100,000. (100,000 units = 1 contract).

Although there is 1 forex broker which allows any number of units to be purchased, that is certainly not the norm. So you can't buy 123,456 units - you would have to buy 123,000 units or 120,000 units or 100,000 units depending on the multiple allowed by your broker.

This is important when it comes to calculating the number of units that ATM will buy. If you enter a percentage of the balance to be used on each trade (in the money management settings), then that percentage is regarded by ATM as the absolute upper limit. ATM only ever rounds-down. The following table gives examples:
 

ATM Wants To Purchase (Units) Oanda Multiple of 1K Multiple of 10K Multiple of 100K
1 1 0 0 0
3,769 3,769 3,000 0 0
9,999 9,999 9,000 0 0
10,000 10,000 10,000 10,000 0
32,769 32,769 32,000 30,000 0
99,999 99,999 99,000 90,000 0
100,000 100,000 100,000 100,000 100,000
132,769 132,769 132,000 130,000 100,000
199,999 199,999 199,000 190,000 100,000
200,000 200,000 200,000 200,000 200,000

Calculate The Result, Then Reverse It

Rules evaluate to either true or false. Line 1 is either above Line 2 or it isn't. True/False. Yes/No. Go/Stop. Using the "calculate the result of this rule, then reverse it" option does exactly as it says. The reverse of true is false; of false is true. No real reason for a lengthy explanation.

But it does need a little explanatory section like this because of a particular scenario. Read on.

Instead of this option, you could always just use a rule which is the opposite. These are opposites:

  1. Line 1 is above Line 2
  2. Line 1 is below Line 2

So what's the difference between these?

  1. Line 1 is below Line 2
  2. Line 1 is above Line 2, and use the "reverse it" option

When Line 1 is below Line 2, both option #1 and #2 are true.

When Line 1 is above Line 2, both option #1 and #2 are false.

When Line 1 equals Line 2, option #1 is false, while option #2 is true.

Using the "reverse it" option, ATM calculates the result of the rule as if you did not use this option, then it takes the opposite of that result.

So when Line 1 equals Line 2, no, Line 1 is not above Line 2 so the normal result is false, then taking the reverse, the result becomes true.

Here's one example to consider - the MACD Histogram cross from below zero to above zero.

For this one, you choose the following entry rules:

  1. Line 1 is below X (zero), use the MACD Histogram indicator, and use a bar offset of 1 (meaning you want the rule to have been true 1 bar ago)
  2. Line 1 is above X (zero), again using the MACD Histogram indicator

These two rules combine to allow an order to be placed only when the MACD Histogram crossed from below zero to above zero.

But what if the value of the MACD Histogram 1 bar ago was exactly zero? In this case the MACD Histogram is neither below zero, nor above zero. So while the MACD Histogram has legitimately crossed from below to above zero, ATM will disallow the trade because it thinks the MACD Histogram was not below zero 1 bar ago.

(Remembering that ATM is in fact doing exactly as you told it to do).

This situation is not going to happen very often. If it did, all that happens is you miss a trade (you can't lose money by not trading). But if you're worried about it, set the entry rules to this:

  1. Line 1 is above X (zero), use the MACD Histogram indicator, a bar offset of 1, and the "reverse it" option.
  2. Line 1 is above X (zero), again using the MACD Histogram indicator

Doing it this way effectively changes the entry rule from being "enter when the MACD Histogram crosses from below to above zero" to "enter when the MACD Histogram goes from not above zero to above zero". There's a subtle difference.
 

# Bars To Load

When you add or edit a rule or value, sometimes you will be asked to fill in the "# Bars To Load" field. This value is used to determine how many price bars should be retrieved.

Less bars means faster processing, and so ATM tries to retrieve the minimum possible. When something like a simple moving average (SMA) is used, it's pretty easy to work out how many bars are required - if it's SMA(20) then ATM retrieves 20 bars.

But for other rules, e.g. those involving "previous SMA swing low", it's not possible to mathematically calculate the number of bars that will be required. Maybe the previous SMA swing low occurred 30 bars ago. Maybe 40. It's in these situations that you'll need to enter the value yourself. Choose a value big enough so that enough bars are going to be retrieved to do the calculation, but small enough so as not to slow ATM down.
 

Last Bar Used

Both trading systems and alerts have these fields, but they are updated slightly differently. For trading systems, only when the entry rules are checked (i.e. a trade is not already open) will the date be updated. For alerts, the date is only updated when an alert wants to fire.

These fields ensure that only fresh price data is being used for entry calculations. Here's the scenario that these fields try to avoid:

  1. A new bar completes.
  2. ATM checks the entry rules and finds that they are true. ATM places an order.
  3. The order is taken up. This trading system is in a trade.
  4. The price goes in exactly the wrong direction, and the stop loss is taken out very quickly.
  5. ATM checks the entry rules and finds that they are true. ATM places an order.

The thing is that the bar being checked in steps 2 and 5 are the same bar. The trade exited so quickly that there wasn't enough time for the next bar to complete (which is a likely outcome if you are using Hourly, Daily bars, etc).

So ATM would have placed two orders based on the same bar. Generally that's not a good thing, hence these fields. And hence the reason they are only updated when the entry rules are checked.

If you want to allow it, you can put a tick-mark in the "If the trade is exited before the entry bar is completed, allow re-entry in that same bar" field.

This is another way to pause a system for a while - by editing these dates to be somewhere in the future (and no tick-mark in the checkbox).
 

Statuses Of Trading Systems And Alerts

These statuses only have some relevance if on the Command Centre you have the alerting or auto-trading scheduled process running.
 

For Alerts

There are 2 statuses:

  1. Enabled - the alert will check its alerting rules as per its frequency settings
  2. Disabled - the alert is dormant

 
For Trading Systems

There are 3 statuses:

  1. Enabled - this system is auto-trading. (So make sure you don't set it to this until everything else is ready).
  2. Disabled - this system is not auto-trading
  3. Trade Mgmt Only - this system will cancel any open orders, and will not place any new orders. It will however, continue to monitor and adjust any open trades, and continue to follow the stop loss and take profit management rules you have specified.

You have to be a little bit careful though, about switching the status from "Enabled" to "Disabled" directly. That will stop auto-trading abruptly. As will, of course, stopping the auto-trading scheduled process. The question is, what will happen if a trading system which was auto-trading still has any open orders, or an open trade?
 

If there is an open order

This would have the effect of orphaning any open orders. The order will remain on the broker's books and may well be turned into a trade. The problem then is that there is nothing looking after that trade. And that's fine if you are using a take-profit to exit, but not good if the system relies on moving the stop-loss in order to lock-in profit.

In the latter case, the trade would not be managed, the stop-loss would most likely eventually be taken out, and it would be at a loss. The up-side is that because stop-losses are mandatory, you will at least only lose a certain amount of money (i.e. not your entire balance).

However, if you kept auto-trading as a whole running, and instead changed the system's status to "Trade Mgmt Only", then in fact the open order(s) would be cancelled the next time the system checks its rules (as per the frequency settings). And that would be the end of that. You would be free to stop auto-trading completely, or change the status to "Disabled", or do nothing - because systems which are doing trade management only will not place any new orders.
 

If there is an open trade

This would have the effect of orphaning any open trades. There would no longer be anything looking after that trade. And that's fine if you are using a take-profit to exit, but not good if the system relies on moving the stop-loss in order to lock-in profit.

In the latter case, the trade would not be managed, the stop-loss would most likely eventually be taken out. Whether it would be at a loss or not would depend on how much trade management had already been done before you switched it off.

However, if you kept auto-trading as a whole running, and instead changed the system's status to "Trade Mgmt Only", then the trade would be managed until it was closed. And that would be the end of that. You would be free to stop auto-trading completely, or change the status to "Disabled", or do nothing - because systems which are doing trade management only will not place any new orders.
 

Other Options

You can of course, shut down auto-trading and then go and manage or close any open orders/trades manually.

You are also free to change the stop-loss at any time manually. ATM will never move a stop-loss to a position of increased risk, so you can lock in some profit manually and ATM won't bring it back down to where it calculates it should be.

Another trick with the status of "Trade Mgmt Only" is that you can make the trades manually, and let ATM do the trade management. There are a number of scenarios where this might be useful, and if you think it might be for you then read this.
 

To Pyramid In

That is, you want to gradually purchase more units as a trade goes in your favour. But you want to exit everything at the same time.

Just like pyramiding out, what you need to do is set up multiple trading systems. The systems would be exact copies of each other, with the only difference being the entry rules. In this way you get different entry points, but they all exit at the same time.
 

To Pyramid Out

That is, you want to take partial profits, but keep some money on the table.

For example, I know of a trading system in which you buy 3 contracts at the same time. The first contract is exited by use of a take profit, perhaps 10 pips above the entry price.

The second contract has a trailing stop-loss.

The third contract is exited when the reverse position is taken (the system was mirrored, and if in a long position, this contract would be exited when the rules for going short were met).

It's important to realise that such rules essentially create multiple trading systems, not just one. You have trading system #1 where you use a 10-pip take-profit, trading system #2 where you use a trailing stop-loss, and trading system #3 where you exit at market when opening a trade in the opposite direction.

And that's exactly how to set it up in ATM - make multiple trading systems instead of one. They'd be an exact copy of each other, except that the trade management rules would differ.

Because every system would have the same entry rules and values, they would all enter a trade at the same time. But with the trade management rules being different, they will exit at different times.

See also:

To Have ATM Place Orders Only (And No Trade Management)

This is good for people who want the entry to be done by a computer, but then want to do the trade management by themselves. Such people may have a mechanical system for knowing when to place orders, but for whatever reason they can't pull the trigger themselves (analysis paralysis, a really complex system with a lot of entry rules, etc). However, once in the trade, they have no trouble looking after it by themselves.

Essentially, you just create a bare-bones trading system - entry rules, entry values, and an initial stop loss value. Once ATM opens the trade, it therefore has no instructions on how to manage it, so you are free to do it yourself.

In this scenario where you want to do the trade management yourself, it might be a good idea to have ATM alert you that it has opened a trade.
 

To Have ATM Do Trade Management Only

This is good for people who want to do the trade entry by themselves, but after that want the trade management to be done by a computer. Such people might have a discretionary system for knowing when to place orders, but the trade management aspect is mechanical. Or maybe you're just at work and see a really good opportunity to buy but you don't have the time to baby-sit the trade once open.

First, you will need a trading system - the one that is going to do the trade management. And, that trading system will require entry rules and values because they are mandatory for a system to do anything at all. The trick is to set the entry rules such that they could never be true. For example, have two trading rules:

  1. the Close must be above SMA(5)
  2. the Close must be below SMA(5)

Both rules could never be true at the same time, so this trading system will never open an order by itself.

The entry value can be anything you like. I guess "enter at market" is easiest, remembering that it will never be triggered. Similarly, set the initial stop loss value to anything simple - maybe entry price minus 50 pips.

You then set up your trade management rules as per your preferences.

Set the auto-trading status of the trading system to be "Trade Mgmt Only". On the Command Centre, start the scheduled processes that download or create the price bars required by your system. And finally, make sure the auto-trading scheduled process is running. You are now free to place orders manually.

From here there are two possible scenarios - whether you can use ATM to place the orders, or whether you're at work or somewhere that you only have access to your broker's platform.

In either case, and this is ** very important ** ensure you always use a stop loss, and ensure a trading system has only one open trade at any time. It is also important to test these strategies in a demo account before proceeding with real money. As you should with any trading system.
 

If you can use ATM to place the orders

When placing your orders or trades manually, do it through the Order window. This lets you specify directly the trading system that opened the order or trade. Also put a tick in the "Handled by ATM" checkbox." Then that trading system (which you have currently auto-trading) sees the trade there and looks after it with its trade management settings.

It's better to use market orders though (which are turned into a trade instantaneously). Because the trading system's entry rules can never be true at the same time, and also because you have the status set to "Trade Mgmt Only", if the system sees an open order there it will want to cancel it.
 

If you can't use ATM to place the orders

In this case, you are restricted to using only one trading system per account to do your trade management (whereas with the above method you can choose from any number of trading systems).

Through the internet, or your broker's trading platform, open a new trade in your account. When ATM downloads the transactions for that account, it will see the new trade there. But because you didn't place the order through ATM, it will not know which trading system to use to manage the trade.

In this case, ATM normally says that the trade was opened by the "Unknown" system. And because the Unknown system doesn't auto-trade, that's the end of the matter as far as ATM is concerned.

However, you can change this so that ATM does not use the Unknown system, but rather uses a trading system of your choice. And this setting can be changed by editing the account (in ATM). Each account has a default trading system setting. Change it to be the system you want to do your trade management.

Now when you open a trade through your broker's platform, ATM will assign that trading system to look after it.
 

Using The Entry Price Indicator

There is a custom indicator called "Special / Miscellaneous". And in that custom indicator family is an indicator called "Entry Price".

I guess normally you would use this indicator in conjunction with the add or multiply options - like:

  • Entry price - 0.0050, which is 50 pips below the entry price for a currency like EUR/USD. Might be a good spot for a long stop loss; or
  • Entry price * 1.025, which is the entry price plus 2.5%. Might be a good spot for a long take profit.

You need to know that this is more accurately referred to as the calculated entry price, if you use this indicator for the initial stop loss or initial take profit values.
 

For market orders

When placing market orders (which is what happens when you set the entry values to "enter at market"), there is no way to tell what the actual entry price is going to be. That's not ATM's fault, that's just the nature of market orders.

But ATM has to put a stop loss along with any orders it places, including market orders. So when you use this indicator for the initial stop loss or initial take profit, ATM has to make an assumption about the probable entry price.

ATM assumes that the entry price is going to be the same as the Open price of the most recent bar. (That is, there is the most recently completed bar that ATM uses to make its calculations, and then after that is the bar that is still in progress. ATM uses the Open of that in-progress bar as the probable entry price).

So let's say that the in-progress bar opened at 1.2500. And let's say you set the initial stop loss to be 100 pips below the entry price. Then, the initial stop loss will be set to 1.2400. Easy.

But, what if the actual entry price was 1.2501? Well, remember that the initial stop loss was set at the time of placing the market order, back when we had no idea what the actual entry price would be. Therefore, the initial stop loss is still going to be 1.2400, which is 101 pips below the actual entry.

Therefore, even though you specified that you want the stop loss to be a certain number of pips below the entry, it could in fact end up more (or less) than that when using "enter at market".
 

For limit orders

While there is far more likelihood that the calculated and actual entry prices will be the same, sometimes there is slippage. Slippage means that the broker couldn't get that exact price you wanted but rather your trade was opened a pip or two away from your preferred entry price. Therefore everything that was said for market orders applies almost equally to limit orders.
 

After Entry

This problem lies only with the initial stop loss and initial take profit values. After the trade is opened, of course we now know the exact entry price. So any other setting using the "entry price" indicator will be calculating using the correct value.