NexusFi: Find Your Edge


Home Menu

 





Keep IB's TWS Running 24x5


Discussion in Trading Reviews and Vendors

Updated
    1. trending_up 4,953 views
    2. thumb_up 5 thanks given
    3. group 1 followers
    1. forum 2 posts
    2. attach_file 0 attachments




 
Search this Thread

Keep IB's TWS Running 24x5

  #1 (permalink)
 TraderSU 
New York
 
Experience: Intermediate
Platform: NinjaTrader, Custom Platform
Broker: IB
Trading: ES, YM, Currency Futures
Posts: 79 since May 2010
Thanks Given: 46
Thanks Received: 75

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

Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Footprint for strategy Builder
NinjaTrader
MC PL editor upgrade
MultiCharts
static margin on the right side of a chart
NinjaTrader
Quantum physics & Trading dynamics
The Elite Circle
Can I use Ehlers Periodogram as the lookback for another …
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
16 thanks
GFIs1 1 DAX trade per day journal
14 thanks
The Trading Pit "Futures VIP" Account Journal
12 thanks
TopStepX from TST
10 thanks
Trading with Intuition
10 thanks
  #3 (permalink)
 TraderSU 
New York
 
Experience: Intermediate
Platform: NinjaTrader, Custom Platform
Broker: IB
Trading: ES, YM, Currency Futures
Posts: 79 since May 2010
Thanks Given: 46
Thanks Received: 75


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)

Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote




Last Updated on July 22, 2010


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts