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

Custom indicators

Video: Creating A Custom Indicator

This tutorial demonstrates how to create a custom indicator, which is then charted.

It assumes:

  1. You started ATM and opened a settings file.
  2. That settings file already has some price bars in it.
  3. ATM is sitting there ready to go.

This tutorial does these things:

  1. Charts some price bars.
  2. Adds an indicator to the chart - the LOW minus 0.3%
  3. Creates a custom indicator implementing the Chandelier Stop.
  4. 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.
 

How To Use Indicators

There are 4 basic concepts that you need to know:

  1. There are Rules and there are Values. Rules decide when an action is allowed. They evaluate to Yes/True/Do or No/False/Don't. Values decide where that action will be done. They evaluate to a single price on the chart - the price where you want to place an order; the price where you want to move the stop loss or take profit.
  2. Relative Strength Index (RSI) is an example of an Indicator.
  3. RSI(14) though, is a line on the chart. It is the combination of indicator plus the parameters that creates a line. RSI(14) is a different line to RSI(20).
  4. Everything is a line. The close price is a line. Volume is a line. The entry price of a particular trade is a (flat) line. RSI(14) is a line. RSI(20) is another line.

Rules

To get a line into something that can become a true/false answer means that we must compare it. We compare it:

  • With a particular number - is Line 1 above 100?
  • With its previous values - is Line 1 going up?
  • With a different line - is Line 1 above Line 2?
  • With the entry price - is Line 1 above than the entry?

The first step then, is to choose what kind of comparison will be done. Here are the options:
 

Use the value of a line
  • Line 1 equals X
  • Line 1 is above X
  • Line 1 is below X
  • Line 1 is in a range
  • Line 1 is not in a range
     
Compare the value of a line to the line's previous values
  • Line 1 is rising
  • Line 1 is falling
  • Line 1's value is the least of the last X values
  • Line 1's value is the most of the last X values
     
Compare the value of a line to the value of a different line
  • Line 1 is equal to Line 2
  • Line 1 is above Line 2
  • Line 1 is above Line 2 by more than X
  • Line 1 is above Line 2 by less than X
  • Line 1 is below Line 2
  • Line 1 is below Line 2 by more than X
  • Line 1 is below Line 2 by less than X
  • Line 1 is apart from Line 2 by more than X
  • Line 1 is apart from Line 2 by less than X
     
Compare the value of a line to the trade's entry price
  • Line 1 is above the trade's entry price
  • Line 1 is above the trade's entry price by more than X
  • Line 1 is above the trade's entry price by less than X
  • Line 1 is below the trade's entry price
  • Line 1 is below the trade's entry price by more than X
  • Line 1 is below the trade's entry price by less than X
     

Those last ones can only be used for non-entry rules.

Anyhow, with one of those selected, all that's left is to fill in the details for Line 1 (and Line 2 if applicable).

A common entry rule is "the close of the bar is above the simple moving average". The close price is just a line, and so is the average, so you would use "Line 1 is above Line 2" - Line 1 is the close, and Line 2 is the average. When this is true the signal is given.
 

Values

Values are easier, because you don't need to bother with the options above. You just create a line and that is the value. E.g. put a take profit at the entry price plus 50 pips, the stop loss at a simple moving average, etc.
 

More Options

You are given these very basic options to modify a line:

  • Line + X
  • Line * Y
  • (Line + X) * Y
  • (Line * Y) + X

Negative numbers can be used for X and Y.

What these settings allow you to do are to add/subtract a certain number of pips or percentage. For example:

  • Close price plus 5% would be: Close * 1.05
  • High plus 50 pips would be: High + 0.0050 (for EUR/USD)

If you need more than these basic options, you can create a custom indicator.
 

Indicators which normally consist of more than 1 line

If you think of the Bollinger Band indicator, you normally think of 3 lines - upper, middle, and lower. But for our purposes, those are actually 3 different Indicators:

  1. Bollinger Band Upper Line
  2. Bollinger Band Middle Line
  3. Bollinger Band Lower Line

And this is true for any indicator which normally consists of more than a single line.
 

Indicators which normally wouldn't be considered Indicators

How can candlesticks be "a line"? Well, at its simplest, a bar either fits a candlestick pattern or it does not. Candlesticks are therefore in a true/false form. But that doesn't fit into the "everything is a line" theory. So instead of thinking in terms of true/false, change it to 1/0.

Most of the time, a candlestick pattern will not be present. The "indicator" value stays at zero. When the candlestick pattern appears, the indicator spikes up to 1. Then back down to zero when the pattern is gone.

What was just described is simply an oscillating indicator, with values ranging between 0 and 1. That's now a line which can be used like any other line. So the basic concept is to replace true/false results and anything similar, with numbers. 0/1. 1/2. -100/100. It doesn't really matter as long as they are numbers.

So let's say we use 0 (zero) for when the candlestick pattern is not there, and 100 when the candlestick pattern is there. To make a rule that uses that candlestick pattern, use "Line 1 equals X" - Line 1 is the candlestick, and set X to 100. When this is true the signal is given.

It turns out candlesticks are actually a little more complex than true/false, anyway. The following are possible:

  • the candlestick pattern is present in a bullish way (result: 100)
  • the candlestick pattern is present in a bearish way (result: -100)
  • the candlestick pattern is not present (result: 0)

Further, there are a couple of candlestick patterns that give five values: 200, 100, -100, -200, zero. You should chart the candlestick you are interested in to see its possible range of values. And that's the beauty of treating everything as a line - you can chart and visualise all indicators and see how they behave.

Note: peak and trough (and swing) calculations, "Current Pattern" and "Previous Pattern" are also treated as oscillating indicators:

  • Higher Peak = 2
  • Higher Trough = 1
  • Lower Trough = -1
  • Lower Peak = -2
     

ATM File Extensions

*.tsatm - settings file

*.tsphd - price history file

*.tssys - exported trading system

*.tsiba - exported alert

*.tsind - exported custom indicator

*.tscht - exported saved chart
 

Privacy Concerns When Exporting

There is the Import/Export window, and that let's you import/export trading systems, alerts, saved charts, and custom indicators.

When exporting, your information is saved as an ordinary text file. You can read the contents by opening the file in Notepad, Wordpad, Microsoft Word, or whatever other program you normally use for text files. Like this:

If you add a password when you export the file, most of it will just be garbled text. Like this:

The very basic details are left unencrypted, but everything else is unreadable. The encryption level is pretty strong.

You can then give that file to a friend, sell it, use it as a backup, or use it to copy your settings to a different ATM settings file of your own.

There are some complications with importing/exporting, and most of them centre around the fact that you could be importing something that you yourself exported; or you could be importing something that somebody else exported.

If you are importing your own exported file, you probably want the same accounts to be re-selected for you. The only way to achieve that is to include the account information in the exported file. That is to say, these exported text files may contain private information that you don't want other people to see.

Only the description you gave for the account is exported (e.g. "My FXCM demo account") - not the account number. But there's every possibility that you typed the account number as part of that description (e.g. "My FXCM live account #12345678").
 

The easy workaround

If you intend to give your exported file to someone else, the solution is very easy. In ATM make a copy of whatever it is you intend to export. Edit that copied version. Remove any private information. Export the copied version instead.
 

Protecting your secret sauce

Use a password when you do the export. That will encrypt the file. For someone to be able to import your encrypted file, they need that password. But the password doesn't unlock the file completely - it just lets them do the import.

Someone successfully importing an encrypted file still won't be able to see the trading rules, etc (if it's a trading system, and alerts and custom indicators can also be obfuscated like this). The person will be able to backtest and trade with that encrypted system / alert / custom indicator. But they won't be able to see how it works. As in, you can sell your fantastic trading system, other people can trade using that system, but your methods are kept secret.
 

Statuses of trading systems and alerts

All imported trading systems and alerts have their status set to "Disabled". Check all details are correct before enabling.
 

Random Number Between 0 And Max 255

There is a custom indicator called "Special / Miscellaneous". And in that custom indicator family is an indicator called "Random number between 0 and max 255".

What that results in is a line filled with random numbers between 0 (zero) and the upper limit you specify. The upper limit can be anything from 1 to 255 (actually you can enter a bigger number, but even if you do so 255 is used).

How is this useful?

Sometimes people like to test the results of their trading system against the results obtained by chance. Along the lines of "are all my fancy rules giving any better result than tossing a coin?"

So after creating your fancy trading system, copy it, delete all entry rules, and replace with one involving this random number. Test the results.

Only whole numbers are used, no decimal points. So a random number between 0 and 1 means that the result will either be 0 or it will be 1. There are only 2 possible results. It's 50-50 as to which will come up, chosen randomly by the computer. So this is just like tossing a coin. Create an entry rule that says only enter when the random number equals 1. And that would give a trading signal, on average, every second bar.

Similarly, a random number between 0 and 5 would be like rolling a dice (as there are 6 possible results - 0, 1, 2, 3, 4, 5).

But normally trading signals aren't given every 2 or 6 bars. If you have tested your original system, you can work out roughly how often it gives trading signals. And then set the upper limit on this random generator to something similar. If you want to do this kind of comparison, you have to be comparing apples with apples.

Just remember that 0 (zero) is always going to be one of the possible results, so if you want a signal approximately every 20 bars then enter an upper limit of 19.
 

Fibonacci Levels (using Min/Max)

To calculate a Fibonacci level you first need a minimum and maximum point. Normally a person is sitting in front of a chart, and they click on a minimum point in the chart, and then a maximum point, and all these Fib lines are drawn for them.

But how should a computer do this? Well, we expressly included the words "(using Min/Max)" in the name to make sure people know how we do it, because we weren't sure if it's the standard way to do this calculation or not. Anyway, when you use this indicator you have to enter 3 values - the maximum period, the minimum period, and the Fibonacci Level as a percent.

Let's say you enter these values:

  • Minimum period: 50
  • Maximum period: 75
  • Fib. level (%): 61.8

First ATM finds the minimum value over the last 50 bars. This low point is thought of as the 0% Fibonacci Level.

Then it finds the maximum value over the last 75 bars. This high point is thought of as the 100% Fibonacci Level.

This Investopedia page on Fibonacci Retracements shows it nicely.

And we wanted the Fib level at 61.8% so we entered 61.8 (some people use 0.618, others 61.8%, and we went with the latter).

So for the standard Fibonacci Retracements, just type in 23.6 / 38.2 / 50.0 / 61.8 / etc. For the standard Fibonacci Extensions, type 161.8 / 261.8 / 423.6 / etc (as per this Investopedia page on Fibonacci Extensions).

But you are not limited to the standard levels. In fact you can type any number you like. You can enter a level of 123.45 if you want. And you can enter a negative number to extend beyond the low point.

  • 61.8 is a Fibonacci Level in between the high and low points
  • 161.8 is an extension going above the high point
  • -61.8 is an extension going below the low point
     

Bar Swings, SMA Swings

 
Bar Swings

Look at two bars which are next to each other. We'll call them Bar #1 and Bar #2.

It's a "Bar Swing Up" when the High of Bar #2 is higher than the High of Bar #1.

It's a "Bar Swing Down" when the Low of Bar #2 is lower than the Low of Bar #1.

Should both conditions be met, that is there is an "outside bar", it's:

  • a Bar Swing Up when the Close of Bar #2 is in the upper half of the candle; and
  • a Bar Swing Down when the Close of Bar #2 is in the lower half of the candle.

If none of those conditions are met, it's neither a Bar Swing Up nor Down.

A Swing Up is always followed by a Swing Down, and vice versa. There is never a Swing Up followed by another Swing Up.

When a Bar Swing Up occurs, you can also calculate the "Bar Swing Low". That's the lowest price between this Bar Swing Up and the Bar Swing Down immediately before it.

When a Bar Swing Down occurs, you can also calculate the "Bar Swing High". That's the highest price between this Bar Swing Down and the Bar Swing Up immediately before it.
 

SMA Swings

A Bar Swing but where the price also closes above/below the simple moving average (SMA). Perhaps a strong signal as Bar Swings can happen every few bars, whereas SMA Swings happen far less often.

The truth is that this can be applied to any overlay - not just the simple moving average. The "SMA Swings" custom indicator is provided as an example. If you wanted to use a different overlay, like the Upper Bollinger Line, or a Fibonacci Level, then copy this custom indicator and just change the calculation of Column #1.
 

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.