Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Reconnect PATS BARCHART Etc.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Reconnect PATS BARCHART Etc.

    I recently posted a reply to an irate user who was upset that you couldn't reconnect a broken feed/connection without manually disconnecting and reconnecting. Barchart has this issue, while Zen-Fire does not (Zen-Fire seems to auto reconnect, but Barchart is not as reliable in this regard, nor is PATS). Anyway, just wanted to start a thread about this.

    Idea:

    Create a small service that could run on XP/Vista that would poll a file that is written to on the local machine or would poll an IMAP account or something of the like. If NT fires an email or writes to a file that a connection is broken, the service could fire up and then run a keyboard macro routine.

    If anyone is up for writing the utility, I would beta test.


    Thank you,


    R2Ktrader

    #2
    Hello r2kTrader,

    Thank you for your post.

    I will forward this on to development for further consideration.
    KyleNinjaTrader Customer Service

    Comment


      #3
      Keyboard Mouse Macro Program - Auto Re-Connect Automatically Reconnect Data Feed

      I have not tried this program, but this seems to be something that may be of use for re-connecting broken connections.

      Learn how to download and install AutoHotkey, to create a script, to use hotkeys and hotstrings, to send keystrokes, to run programs, etc.


      NOTE: This program supports loops like checking a file every x number of seconds. This would be ideal because you could have NT write to a local file if connect is lost and then when autohotkey reads the file and finds the appropriate command or whatever, it would take action and do as you commanded it. It could also do things which may be helpful. For example, it could take a screenshot of your account and connection status etc. so you could get VISUAL picture of what is actually going on, and then email it to you periodical as trades fire, etc.

      This explains the file read loop feature:


      This way you are getting a view from the outside looking in, verses from the inside out. This helps to provide a human perspective of the situation and help to avoid a programmatic mistake as it relates to information being sent from the very program that you are trying to watch.

      It can read and write from files, so if a connection breaks and needs to be disconnected/reconnected, you could have this program poll a file and then run a keyboard macro that will reconnect the data feed.

      The other reason I like this as opposed to email notification, is because it may be the internet circuit that went down. If this were the case and you needed to be notified, then you could have your computer's modem dial your cellphone relentlessly or something like that. Some of the new modems would allow you to play a recorded message or again, you could just have your modem page your phone and put in a certain number meaning you better call your broker.

      I thought this thread would garner more interest due to the importance of this issue. I for one have had issues with PATS and Barchart reconnecting automatically. It seems I was only able to reconnect most of the time by doing so manually. :-(

      Looking forward to feedback.


      r2kTrader
      Last edited by r2kTrader; 02-22-2009, 09:19 AM.

      Comment


        #4
        NT - We need more hot key support

        Dear Support,

        [UPDATE]
        For those of you who want to use the AutoHotKey dilio, please know that NT does indeed support hot keys. You will only see the hotkey sequences though, if you use your keyboard to navigate. For example, if you click your mouse on the control panel and select file, both Connect and Disconnect do not show the C and D letters with an underline as it detects you are using the mouse. If however, you use Alt+F to drop down the file menu, you will see the Connect and Disconnect do indeed support hot keying. Well done NT. Is there an option to leave hotkey navigation always on? Perhaps that setting / bool should be added.


        Until such time as we have a way to programmatically reconnect a broken data feed, we could use some help with hot keys for this work around I am proposing.

        As it stands, ( I just checked the menus on Control ) and there is no hot key support for the connection/disconnect menu items, thus I would have to send an arrow key up/down sequence, etc. in order to macro a disconnect/reconnect script.

        It might make more sense to just provide a function to disconnect and reconnect in the time it would take to add menu hot keys, but I have no idea which is faster or if this thread is even a good idea.

        But as other members have mentioned, I can't have a system auto trading if I can't be assured that the connection is being monitored and managed using all the technology that is available to us in this day and age.

        The even bigger concern is the fact that I don't want to stare at my system, as I am trying to set and forget, not set and stare , lol.



        Thanks,


        r2kTrader
        Last edited by r2kTrader; 02-22-2009, 09:23 AM.

        Comment


          #5
          Re-Posted for this Forum - AutoHotKey - Trial Results

          I have good news regarding the reconnect issue. I downloaded and played with HotAutoKey. It is amazingly simple.

          I just did my first script and saved it to a file. It worked FLAWLESSLY.

          This is the code it auto generated for me and it worked straight away even when control was minimized:

          IfWinNotActive, Control Center - Default, Limit Price:, WinActivate, Control Center - Default, Limit Price:
          WinWaitActive, Control Center - Default, Limit Price:
          Send, {ALTDOWN}f{ALTUP}db{ALTDOWN}f{ALTUP}cb


          The db is the first letter for Disconnect and b is the first letter for Barcharts (my connection). So I did a disconnect/reconnect. WORKED PERFECT! So now I just need to setup a loop in HotKey to poll a file religiously and then I can streamwrite to that file in the event I want to trigger a reconnect.

          One thing I can say right off the bat is this. If you are a serious trader who is using NT with real money, you will probably want a dedicated box running and as such I would recommend renting a windows based server from a hosting provider. You get bullet proof connectivity and all the benefits of a power reliability and backups. You then have your box setup so that NOTHING runs except Ninja and your AutoHotKey program. This way you can be assured less complications when you need your macro to run. You can get a dedicated box as a VPS for like 39.00 per month and that includes huge bandwidth, etc. This also assures you don't have to have that system used for anything other than NT. And finally, you can access your box from anywhere and do so conveniently. I would have it set to close all ports and then use a port-knocking sequence to open the remote port for access (this if you want to know about port knocking, let me know. What it does is close your box to the outside world unless a certain sequence is dialed. I recommend this as I would not leave money hanging by my front window just because the door is locked. Rather I would only let the money hang by the window if I was the only one who could see the window, copy??).


          This will be a big help for you. Please join us in the thread and share your scripts.

          Comment


            #6
            Originally posted by r2kTrader View Post
            For those of you who want to use the AutoHotKey dilio, please know that NT does indeed support hot keys. You will only see the hotkey sequences though, if you use your keyboard to navigate. For example, if you click your mouse on the control panel and select file, both Connect and Disconnect do not show the C and D letters with an underline as it detects you are using the mouse. If however, you use Alt+F to drop down the file menu, you will see the Connect and Disconnect do indeed support hot keying. Well done NT. Is there an option to leave hotkey navigation always on? Perhaps that setting / bool should be added.
            I believe this is a Windows thing in general. In XP you can right click on the desktop and go to Properties, then Appearance, then Effects and uncheck "Hide underlined letters for keyboard navigation until I press the Alt key".

            Comment


              #7
              You're right! Thank you for clearing that up.

              Originally posted by michaelangela View Post
              I believe this is a Windows thing in general. In XP you can right click on the desktop and go to Properties, then Appearance, then Effects and uncheck "Hide underlined letters for keyboard navigation until I press the Alt key".

              Comment


                #8
                What about a script to:
                shut down NT, confirmation on NT exit window, check process not in memory, start it up again, connect?

                Comment


                  #9
                  Yes, that could be done quite easily.

                  1. You would need a vbscript to check for running threads and then set it to scrub that thread (look for it by name presumably)

                  Here is an example as taken from:



                  ' ProcessKillRemote.vbs
                  ' Sample VBScript to kill a program
                  ' Author Guy Thomas http://computerperformance.co.uk/
                  ' Version 2.9 - December 2005
                  ' ------------------------ -------------------------------'
                  Option Explicit
                  Dim objWMIService, objProcess, colProcess
                  Dim strComputer, strProcessKill, strInput
                  strProcessKill = "'NinjaTrader.exe'"

                  ' Input Box to get name of machine to run the process
                  Do
                  strComputer = (InputBox(" ComputerName to Run Script",_
                  "Computer Name"))
                  If strComputer <> "" Then
                  strInput = True
                  End if
                  Loop until strInput = True


                  Set objWMIService = GetObject("winmgmts:" _
                  & "{impersonationLevel=impersonate}!\\" _
                  & strComputer & "\root\cimv2")

                  Set colProcess = objWMIService.ExecQuery _
                  ("Select * from Win32_Process Where Name = " & strProcessKill )
                  For Each objProcess in colProcess
                  objProcess.Terminate()
                  Next
                  WSCript.Echo "Just killed process " & strProcessKill _
                  & " on " & strComputer
                  WScript.Quit
                  ' End of WMI Example of a Kill Process

                  2. Then your HotKeyScript would call that script during it's process. Not a big deal. You would probably want your vbs script to write to the file you are polling from your autoKeyScript so it knows when the thread has been terminated. So your script would go into a loop until it confirms the thread NinjaTrader.exe is completely down. I think with about 3 hours of time invested, you could have a fairly tight solution that will bring you a long way closer to your vision, but alas, not perfect. I would include screenshots to be sent to an IMAP or web based account, etc. so you can see what the screen actually looks like if the hotkeyscript is called due to a malfunction of NT or the like. A picture could be worth 1,000.00 in this case ;-0

                  Ugly? heck yeah. Ridiculous? heck yeah. Better than nothing? absolutely.



                  Originally posted by skynetman View Post
                  What about a script to:
                  shut down NT, confirmation on NT exit window, check process not in memory, start it up again, connect?
                  Last edited by r2kTrader; 02-24-2009, 08:11 AM.

                  Comment


                    #10
                    Also, I would recommend doing this all on the machine you intended on using it on. This way screen size, etc. will all be consistent. That may come into play if you have to use mouse moves to make thing happen (like start a strategy.)



                    Originally posted by skynetman View Post
                    What about a script to:
                    shut down NT, confirmation on NT exit window, check process not in memory, start it up again, connect?

                    Comment


                      #11
                      Thanks for the great work on this. I'm attempting to migrate from Tradestation to Ninjatrader and am looking at using MF Global with Pats. It looks like setting up a nightly job to bounce Ninjatrader will be needed, and reconnecting to Pats looks fairly straightforward using Autohotkey and the great tips provided here. However, I'm unclear if it will be possible to also automate the opening and starting of a strategy (for live trading) using Autohotkey (or any other method) after bouncing Ninjatrader.

                      Has anyone been able to also automate starting a strategy after bouncing Ninjatrader? In the tradestation world, strategies are saved with charts, and automatically open and start when the process is restarted. I'm new to Ninjatrader, but from what I"ve seen, strategies are not saved with charts, and it doesn't appear possible to automatically have them open when restarting Ninjatrader. Further complicating this is the fact that some strategy input parameters don't appear to be able to be set through Ninjascript - such as Data series type. So there would have to be a way to not only open and start a strategy, but also ensure that strategy input parameters are set correctly.

                      Any suggestions would be greatly appreciated,
                      Thanks,
                      Poze97

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by NullPointStrategies, Yesterday, 05:17 AM
                      0 responses
                      71 views
                      0 likes
                      Last Post NullPointStrategies  
                      Started by argusthome, 03-08-2026, 10:06 AM
                      0 responses
                      143 views
                      0 likes
                      Last Post argusthome  
                      Started by NabilKhattabi, 03-06-2026, 11:18 AM
                      0 responses
                      76 views
                      0 likes
                      Last Post NabilKhattabi  
                      Started by Deep42, 03-06-2026, 12:28 AM
                      0 responses
                      47 views
                      0 likes
                      Last Post Deep42
                      by Deep42
                       
                      Started by TheRealMorford, 03-05-2026, 06:15 PM
                      0 responses
                      51 views
                      0 likes
                      Last Post TheRealMorford  
                      Working...
                      X