Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
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 for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
I have been looking for a solution for awhile to send the same order to multiple platforms (Sierra Charts LIVE, Sierra Charts SIM, NT8 SIM). I've switched all live trading over to Sierra Charts and most of the charting but have had to still use NT for Jigsaw. This caused a bit of a issue with not being able to see active orders on the Jigsaw DOM and I ended up having to try watch 2 separate screens when in a trade and this became a issue when I needed to closely watch the Jigsaw DOM as I would sometimes loose track of price levels.
So the solution was to setup hotkeys that would send the same command to each platform with the ability to turn off/on the commands to the Sierra Charts LIVE platform as needed on the fly.
Here is the working code that I have come up with using AutoHotKey
Please excuse any mistakes or lack of proper coding etiquette, this is the 1st thing I've put together. Any feedback, pointers or better ways would be greatly appreciated. (A big thanks has to go to a mate who sat down and explained what Variables are and how to capture them for the session.)
After all 3 platforms are running, launch complied AHK program.
See attached "Hotkeys_3_Platforms_A.txt" for full code. This needs to be saved as a .ahk file before it can be complied. Open file in Notepad>save as>(Save as type: All files)> yourfilename.ahk>Save.
Must have AutoHotKey installed> right mouse click yourfilename.ahk> Compile Script
It will then produce the autohotkey application and when its needed> right mouse click> Open
It will stay running in the task manager background processes for the computer session or until you manually kill it in Windows Task Manager.
The Sierra Charts LIVE platform was positioned 1st in line, followed by NT SIM with the Jigsaw DOM as this is the order of importance I needed when live trading and to cut down on slippage due to delayed execution when 3 commands are sent one after the other. I have noticed some small differences of 1 tick occasionally on the 3rd platform but I'm not really using it to live trade, its just the fall back sim trade so it doesn't cause any real issue for me.
The above AHK program will then make each platform "window" active when needed. If you manually switch charts (Child Tab) on all 3 platforms and bring a new instrument to the forefront EG- ES to ZB, the hotkeys will then work on those charts.
NOTE: You MUST activate "Trading Keyboard Short Cuts Enabled" on EACH chart you need in Sierra charts. When each chart is at the forefront in Sierra Charts> Trade> Trading Keyboard Short Cuts Enabled. It will then allow Hotkeys to be used on this chart when its at the forefront of the parent window and will only use hotkeys on that chart while its at the forefront "active". (I think you need to enable "Chart Trade Mode" and(??) "Attach Trade Window to Chart"on each chart the hotkeys will be used on.)
Nt doesn't need each chart enabled, it has a global setting. Tools> Options> Trading> Use Order Entry hot keys. It will then allow Hotkeys to be used on this chart when its at the forefront of the parent window and will only use hotkeys on that chart while its at the forefront "active". (I think you need to enable "Chart Trader" on each chart the hotkeys will be used on.)
I kept Alt + "*" for the hotkeys to be set inside each platform and have attached a spreadsheet with the legend I used for each platform. These must be manually set in each platforms hotkey settings. Alternatively, you can change the code to suit your own platform hotkey bindings. In the code, I used all lower case for the platform hotkey alphabetic keys but on the legend I used uppercase so that they clearly show what letters are used.
I used Ctrl + "*" for the hotkeys for AHK.
This then allowed "Shift" to still be used normally for typing on the keyboard and not accidentally fire off a hotkey that triggers a order somewhere.
This can be used to setup any programmable keyboard. Modify to suit your needs and number of platforms.
My next thing to tackle is to setup and use the 5 keys in the upper left of the "Trading Keyboard Hotkeys.PNG" to somehow bind them to individual child tabs in each trading platform window so that 1 key will bring all 3 platforms ES charts to the forefront, another will bring all 3 platforms 30yr US Treasuries ZB charts to the forefront and so on.
Seeming to run into some major issues with doing this as AutoHotKey doesn't like finding child tabs, making them active and bringing them to the forefront inside the parent window. There are ways around it by using known x, y screen positions and auto-mouse clicking the tabs but this would mean everything needs to stay in the same relative screen positions all the time with nothing obstructing the mouse click target which is not ideal. The other option is to search for a image of the tab name but this is slow and prone to issues from what I have read.
If anyone knows how to do this using AutoHotkey or even a completely different language/way, it would be great to hear some options to look into.
Please give feedback on where I can improve, this is my 1st effort and its taken a bit to get my head around.
NinjaTrader 8 Multi Instrument and Multi Date Range Historical Market Replay Data Download Automation
Functionality
Script automates the download of Historical Market Replay data for multiple instruments and download dates by simulating mouse clicks and keystrokes on NinjaTrader GUI.
This is my first AutoHotkey script so may need changes after user testing and feedback !
Save this code with a .ahk extension into a Windows folder
There are 5 parameters in the script to check/modify -
InstrumentList - Comma separated list of instruments. This example code show MNQ and MES
StartDate - Starting date for download. Check with your broker/market data provider documentation as to how much historical market replay data they provide. e.g. Rithmic only seems to have 90 days of Market Replay Data
NumberofDaysToDownload - Can be set to whatever valid number of days you want
SkipSaturday - Should be set to false for Equities and Futures
SkipSunday - Should be set to false for Equities. Can be set to true for Futures which start trading on Sunday
Start NinjaTrader 8 and make sure the Control Center window is Active
Double click the script to start the mouse and keyboard stroke emulation. Windows will know the association between a .ahk file extension and will invoke the AutoHotkey interpreter automatically. There is no need to run AutoHotkey from Windows Menu separately.
Whilst the script is running DO NOT use any other window as it could send the emulation to the wrong active window. There is some defensive code where the script tries to make the NT8 Historical Data window the active window before sending any mouse or keystrokes but the code might not cover all scenarios.
If you need to abort the download then close the Historical Data window and the script will detect that the window is not present and exit.
When using for the first time, just try for 1 or 2 instruments, a valid start date and number of days to download set to 1. This will make sure your installation is working before using the multi instrument and multi day download parameters.
If you have a slow PC then SleepBetweenActions may need to be increased from 400ms to a higher value.
Testing
Tested only on NinjaTrader 8.1.1.1, Windows 11, AutoHotkey v2
Tested only for Futures.
If you are a developer and have Visual Studio Code installed then get the extensions AutoHotkey v2 Language Support by thqby and vscode-autohotkey-debug by zero-plusplus to see the scripts debug messages as it processes.
Warning
Do not have other windows open apart from NinjaTrader 8 open to avoid possible issues with the script sending mouse and keystrokes to the wrong window.
Leave me feedback or suggestions if you do use this script including a successful or unsuccessful installation!
If i understand correctly, we just need to copy paste the text within the code area and save it under whatever name. Do we need to add a specific extention to the file name ?
Is it normal that the ;InstrumentList starts with a ';' ?
I have amended the posted code to show an example for downloading data for MNQ and MES. So copy code again into a .ahk file extension rather than .txt.
Then just double click on it. Windows will automatically process this file through the installed AutoHotkey program.
The ; character in the code is used for commenting out a line in AutoHotkey.
/* Click Tools menu item */
MouseClick("Left", 250, 10)
This is the position for the Tools menu option on my NT8 V8.1.1.1 and the mouseclick at this position opens up another menu on which the script clicks the Historical Data option
Tools Menu
Post an image of your equivalent screen so that I can see if your layout is different to mine.