Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
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.
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
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
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.
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.
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'
etc.
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.
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.
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'
etc.
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.
Thanks. No change, so maybe it is the Windows calls on the XP
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.
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.
Thank you for your efforts, but there is no response even to the window message. So it must be the XP setup
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.
;######################################
;###
;### Check mam.econonday.com and Forex Factory
;### for FOMC/Bernake events for today
;###
;######################################
msg := get_news_events("FOMC,Bernanke") ;### Get Fed events
if ( msg != "" ) {
MsgBox %msg%
}
else MsgBox No News Events
;###
;### Get News Events
;###
get_news_events( events )
{
;### EconoDay
msg :=""
str := get_url("http://mam.econoday.com/byday.asp?cust=mam&day=%A_DD%&month=%A_MM%&year=%A_YYYY%")
;str := get_url("http://mam.econoday.com/byday.asp?cust=mam&day=31&month=8&year=2012") ;### For Testing
Loop, parse, events, `, , %A_Space%%A_Tab%
{
pattern := "iP)\d+:\d+.*?" . A_LoopField
index := RegExMatch(str, pattern)
if ( index > 0 ) {
str := SubStr(str,index)
msg := "Eononday Event`r`n" . SubStr(str,1,RegExMatch(str, "\n")) . "`r`n`r`n"
}
}
;### ForexFactory
str := get_url("http://www.forexfactory.com")
;str := get_url("http://www.forexfactory.com/index.php?day=aug31.2012") ;### For Testing
Loop, parse, events, `, , %A_Space%%A_Tab%
{
pattern := "iP)\d+:\d+.*?" . A_LoopField
index := RegExMatch(str, pattern)
if ( index > 0 ) {
str := SubStr(str,index)
msg := msg . "ForexFactory Event`r`n" . SubStr(str,1,RegExMatch(str, "\n")) . "`r`n`r`n"
}
}
return, msg
}
;###
;### Get Web Page Text
;###
get_url(url, line=""){
doc := ComObjCreate("HTMLfile")
pwhr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
pwhr.Open("GET",url)
pwhr.Send()
doc.write(pwhr.ResponseText)
text := doc.body.outerText
if not line
return, text
s := InStr(text, "`n", 0, 1, line-1)
e := InStr(text, "`n", 0, s+1)
return, Trim(SubStr(text, s+1, e-s-1), "`r`n")
}
ExitApp