I use AutoHotkey extensively in my trading to automate much of the routine tasks that I have to do during the trading day. I want to include here some of the AutoHotkey scripts I use. AutoHotkey is a free, open-source macro-creation and automation software utility that allows users to automate repetitive tasks, using a simple but powerful interpreted scripting language.
To use AutoHotKey, download and install the software, then run the scripts that will be shared in this thread.
Feel free to share your scripts here as well.
Last edited by monpere; September 10th, 2012 at 03:09 AM.
The following 10 users say Thank You to monpere for this post:
Several people have discussed how to quickly place orders on Ninjatrader charts. I do this using the following script. It basically issues Ninjatrader buy/sell stop or limit using the NT chart trading cursor menu. Autohotkey scripts are designed to normally run in the background as stay resident programs, so you generally run the script once, it stays in memory, and you can repeatedly use the programmed hot key sequence to perform the desired function.
In my scripts I generally require the 'Scroll Lock' key to be set for any hot key to be executed. This prevents accidental executions. When I see the Scroll Lock LED is turned On, on my keyboard, I know my keyboard is live.
In the following script, I require that the user presses down the left mouse key at the desired price level and hit Control-B for buy, or Control-S for sell. This should prevent your cat from walking across the keyboard and entering a trade
The following 18 users say Thank You to monpere for this post:
As a scalper I found I wanted to be able to quickly switch from one monitor, to a chart on another monitor far away, in order to enter a quick trade. Dragging the mouse across multiple monitors, and finding the buy button on that chart often took longer then I wanted. So, I created some hotkeys to quickly switch to specific charts on specific monitors.
I personally use 3 monitors, but in this code, I am assuming the use of 6 monitors arranged in 2 rows of 3 monitors, and switching monitors using the Insert/Delete,Home/End, PageUp/PageDn Navigation keys. I sometime use 2 charts per monitor, where each chart occupies the right or left half of the screen. A single click on a particular navigation key will go to chart1 on that monitor, a double click of the same key will go to chart2 on that same monitor. You can change the numbers and positions to allow for different amount of monitors and/or configurations
Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).
Last edited by monpere; September 10th, 2012 at 03:00 AM.
The following 12 users say Thank You to monpere for this post:
Favorite Futures: Index,Currency and Energy futures
Posts: 1,701 since Jan 2010
Thanks: 501 given,
I have implemented this script, and it does not seem to work at all. I am still using XP profressional, so maybe this could be the problem. I have other small scripts that work, so it must be something in the code that is not reading the window system calls correctly.
The following user says Thank You to perryg for this post:
I am using Windows Vista. Many of the more advanced built in functions in AutoHotKey return null or 0 with older Windows versions 95/98/ME/NT/2000/XP. You may want to simplify the script by removing the monitor configuration calls and replacing the monitor dimension variables with hardcoded values, i.e. replacing:
'TopLeft_Chart2 = %x2%, %y%' with 'TopLeft_Chart2 = -100, 650'
'MidCenter_Chart2 = %x2%, %y%' with 'MidCenter_Chart2 = 950, 650'
Also, make sure the 'Scroll Lock' key is set to ON (Scroll Lock LED is lit on the keyboard), the script ignores hot keys, when scroll lock is off.
Last edited by monpere; September 10th, 2012 at 08:45 AM.
Just watched a video about upgrading trading computers and one survey says 60% traders still using XP. (2001 technology) I was one. So I recently and finally upgraded from XP to Windows 7 64 bit with i7 3770k processor with internet of 63MB download/12mb upload.
Put the following 3 lines after the line that says 'desktopWidth += M%A_Index%_Width'
l := Monitor%A_Index%Left
t := Monitor%A_Index%Top
MsgBox Monitor %A_Index% at %l%, %t%
This should popup a message that shows the x,y location for each of your monitors found on your extended desktop. On my machine it returns "Monitor 1 at 0,0", "Monitor 2 at 1024,0", "Monitor 3 at -1280,0"
If it doesn't return anything, or all zeros, then the system calls are returning default 0 values on Windows XP.
Last edited by monpere; September 10th, 2012 at 09:53 AM.
I don't trade the news, but a couple of weeks ago, I almost got caught in an unusual market move which seems was a reaction to a Bernanke speech. I normally use the MarketReminders indicator to put reminders on my charts of scheduled market events such as FOMC days, Contract Rollover dates, Crude Oil Inventory, and certain other reports etc., but I don't normally care about other market news and most reports.
So, I wrote this little script that goes out to Econoday and ForexFactory sites and alerts me of certain events for that day. Namely it looks for any events that mentions 'FOMC', or 'Bernanke'. It pops up a message showing the entry for any such events it finds for the current day. This script is run automatically every morning. You can change it to search for any term that is important to you.
This script actually does not have any hotkeys, it runs once and then exits.
Last edited by monpere; September 12th, 2012 at 02:41 PM.
The following 8 users say Thank You to monpere for this post: