Trading Articles
Article Categories
Article Tools
Keep IB's TWS Running 24x5
Updated July 22, 2010
trending_up
4,752 views
thumb_up
5 thanks given
group
1 followers
forum
2 posts
attach_file
0 attachments
Welcome to futures io: the largest futures trading community on the planet, with well over 150,000 members
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 and simple.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Keep IB's TWS Running 24x5
(login for full post details)
#1 (permalink )
New York
Experience: Intermediate
Platform: NinjaTrader, Custom Platform
Broker: IB
Trading: ES, YM, Currency Futures
Posts: 79 since May 2010
Thanks: 46 given,
75
received
This is AutoIt (google for AutoIt 3) script that I use to keep my TWS (demo or real account) alive for ever (manual shutdown).
Code
Opt("TrayAutoPause", 0)
Opt("MouseCoordMode", 0)
Opt("WinTitleMatchMode", 2)
TraySetIcon("Shell32.dll", 180)
; Demo mode
Do
WinWaitActive("Exit Session Setting")
WinMove("Exit Session Setting", "", Default, Default, 320, 200)
; Make AM to PM & PM to AM
If @HOUR > 12 Then
MouseClick("left", 156, 78, 1)
Else
MouseClick("left", 208, 78, 1)
EndIf
MouseClick("left", 120, 188, 1)
Sleep(4000)
WinClose("Exit Session Setting")
Until 1 = 2
; Never exit
Code
Opt("TrayAutoPause", 0)
Opt("MouseCoordMode", 0)
Opt("WinTitleMatchMode", 2)
TraySetIcon("Shell32.dll", 180)
; Live mode
Do
WinWaitActive("Exit Session Setting")
WinMove("Exit Session Setting", "", Default, Default, 320, 170)
; Switch from AM to PM & PM to AM
If @HOUR > 12 Then
MouseClick("left", 157, 63, 1)
Else
MouseClick("left", 208, 63, 1)
EndIf
MouseClick("left", 120, 148, 1)
Sleep(500)
WinClose("Exit Session Setting")
Sleep(2000)
Until 1 = 2
; Never exit
The following 5 users say Thank You to TraderSU for this post:
Can you help answer these questions from other members on futures io?
Best Threads (Most Thanked) in the last 7 days on futures io
(login for full post details)
#3 (permalink )
New York
Experience: Intermediate
Platform: NinjaTrader, Custom Platform
Broker: IB
Trading: ES, YM, Currency Futures
Posts: 79 since May 2010
Thanks: 46 given,
75
received
This AutoIt script will allow you to automate the TWS login for demo account.
It should also work for real account if security token is disabled (but real account's keeping username/password in a script is a bad idea). But feel free to use keep alive script after manual login.
Code
Opt("MouseCoordMode", 0)
If NOT WinExists("Login") Then
; Run TWS
ShellExecute("C:\WINDOWS\system32\javaw.exe", "-cp jts.jar;hsqldb.jar;jcommon-1.0.12.jar;jfreechart-1.0.9.jar;jhall.jar;other.jar;rss.jar -Dsun.java2d.noddraw=true -Xmx512M jclient/LoginFrame D:\Jts", "D:\Jts")
; Wait
WinWait("Login")
EndIf
WinActivate("Login")
Sleep(200)
MouseClick("left", 130, 55, 2)
Send("username")
Sleep(200)
MouseClick("left", 130, 80, 2)
Send("password")
Sleep(200)
; Press Login
MouseClick("left", 170, 210)
Last Updated on July 22, 2010
Ongoing