Keep IB's TWS Running 24x5 | Trading Reviews and Vendors


futures.io - futures trading strategies, market news, trading charts and platforms


Trading Reviews and Vendors


Discuss and review vendors of commercial trading products, trading rooms and services, trading indicators or third-party paid add-ons




 

Keep IB's TWS Running 24x5

  #1 (permalink)

Elite Member
New York
 
Futures Experience: Intermediate
Platform: NinjaTrader, Custom Platform
Broker/Data: IB
Favorite Futures: ES, YM, Currency Futures
 
Posts: 79 since May 2010
Thanks: 46 given, 70 received

Keep IB's TWS Running 24x5

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


Last edited by TraderSU; October 20th, 2011 at 08:01 PM. Reason: bug fix (inverted the exit logic) - thanks cw3000
Reply With Quote
The following 5 users say Thank You to TraderSU for this post:
 
Page generated 2018-10-15 in 0.07 seconds with 11 queries on phoenix