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

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:

  1. arg1
  2. arg2
  3. 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:

  1. arg1
  2. with
  3. spaces
  4. arg2
  5. 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:

  1. arg1 with spaces
  2. arg2
  3. 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:

  1. arg1 "with" spaces
  2. arg2
  3. 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:

  1. C:\User\Bob\Settings File 1.tsatm
  2. 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:

  1. If you run ATM from the command line, the arguments above will override the settings in the Options window.
  2. 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 arg3

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

Groups:

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <img> <em> <strong> <u> <strike> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote> <h4> <h5> <table> <thead> <tbody> <th> <tr> <td>
  • Lines and paragraphs break automatically.
  • Image links with 'rel="lightbox"' in the <a> tag will appear in a Lightbox when clicked on.
  • Image links with 'rel="lightshow"' in the <a> tag will appear in a Lightbox slideshow when clicked on.

More information about formatting options