ninjatrader/utilities/TickDataConversion/README.md

68 lines
3.2 KiB
Markdown
Raw Normal View History

2024-08-16 20:24:22 +00:00
# Poor Man's Guide to Historical Tick Data for NinjaTrader
This guide covers how to import historical tick data from Sierra Chart into NinjaTrader for cheap.
2024-08-16 20:45:18 +00:00
A 1-month subscription to Sierra Chart (and the Denali Exchange Data Feed), which is sufficient for the purpose of this guide, is ~$40.
Services such as Portara CQG cost ~$800 per instrument (e.g., S&P 500 E-Mini Futures).
Depending on how much data you require, this could save you thousands of dollars.
## Exporting Data from Sierra Chart
1. Go to Global Settings > Data / Trade Service Settings.
2024-08-16 18:08:37 +00:00
2. Make sure Intraday Data Storage Time Unit is set to 1 Tick and that the Maximum Historical Intraday Days to Download for 1-Tick Data is set to a period long enough to download all the data in the contract (doesn't have to be 730 days as shown in the screenshot, 45-60 days should be more than enough).
3. Apply All changes.
![Data / Trade Service Settings](./images/data_trade_service_settings.png)
2024-08-16 20:27:42 +00:00
4. Connect to the data feed if not already (File > Connect to Data Feed).
5. Go to File > Find Symbol.
6. Enter the symbol for the contract you want to download data for.
![Find Symbol](./images/find_symbol.png)
7. Open Intraday Chart, then Close.
8. Wait for historical data to download / chart to finish loading.
2024-08-16 20:27:42 +00:00
9. Disconnect from the data feed (File > Disconnect).
10. Go to Edit > Export to Intraday Text File.
![Export to Intraday Text File](./images/export_to_intraday_text_file.png)
11. Click save and wait on the export to complete.
12. Repeat this process for as many contracts as you desire.
## Converting Data to NinjaTrader's Expected Format
The exported tick data can be converted into the format that NinjaTrader expects by running the script ```convert_tick_data.py```.
The script depends on ```pandas```, so make sure the package is installed.
Make sure to specify the file exported from Sierra Chart as the input and name the output file accordingly.
The output file name matters, so refer to [NinjaTrader's documentation](https://ninjatrader.com/support/helpGuides/nt8/NT%20HelpGuide%20English.html?importing.htm) on importing tick data for more information.
Important bit:
> When using the NinjaTrader format, the name of the text file to be imported must be the NinjaTrader instrument name followed by a period and "Last", "Bid", or "Ask" depending on the data type. For example:
>
> MSFT.Last.txt for Microsoft stock last price data
>
> ES 12-09.Bid.txt for the S&P E-mini December contract bid price data
>
> EURUSD.Ask.txt for the Euro/U.S. dollar currency pair ask price data
2024-08-16 20:24:22 +00:00
The price that this script outputs is the **Last** price.
2024-08-16 20:24:22 +00:00
## Importing Data into NinjaTrader
1. In the NinjaTrader control panel window go to Tools > Import > Historical Data.
2. Select the desired Format (e.g., NinjaTrader (end of bar timestamps)), Data Type (e.g., Last), and Time Zone of Imported Data (e.g., UTC).
3. Select "Generate 'Minute' bars from imported tick data" if you wish to do so (recommended).
4. Click Import and select the output file(s) from the tick data conversion script.
![Historical Data Import](./images/historical_data_import.png)
5. Finally, wait for the import to complete (it will take a while), and then enjoy backtesting with cheap historical tick data.
---