NexusFi: Find Your Edge


Home Menu

 





Keep IB's TWS Running 24x5


Discussion in Trading Reviews and Vendors

Updated
    1. trending_up 4,933 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?
Build trailing stop for micro index(s)
Psychology and Money Management
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Ninja Mobile Trader VPS (ninjamobiletrader.com)
Trading Reviews and Vendors
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
59 thanks
Funded Trader platforms
37 thanks
GFIs1 1 DAX trade per day journal
22 thanks
NexusFi site changelog and issues/problem reporting
22 thanks
The Program
20 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