MDTGrep is an Advanced Custom Study Interface and Language (ACSIL) DLL for Sierra Chart.
It enables lightning-fast, highly accurate data extraction of your Sierra Chart historical/live datasets into easily parsable flat CSV format. Ideal for strategy backtesting on minute-by-minute or exact 1-tick granularity.
- Chart Native Extraction: Since MDTGrep runs directly on the chart, it automatically inherits everything you are currently looking at on the screen. This means any back-adjustments, continuous contract rollovers, or custom session times you have applied to your Sierra Chart are natively built into the exported data.
- Customizable Timeframes: Bar periodicity natively dictates what exports. Whether you want an export of exactly 60 seconds (1 minute), or highly granular 1 Number of Trades (Tick) data, MDTGrep adapts perfectly to your
Chart Settings -> Bar Period. - Precise Unix Epochs: By extracting internal C++ dates into exact UNIX Epoch floating point timestamps (
unix_ts_ms), timestamps perfectly map to machine-learning models, external analytics suites (Pandas, Polars), or internal database engines.
- Copy
MDTGrep.cppto your Sierra Chart source folder (usuallyC:\SierraChart\ACS_Source\). - Open Sierra Chart.
- Go to
Analysis->Build Custom Studies DLL. - Check
MDTGrep.cpp. - Click Build Remote (or Build Local if you have a local compiler setup).
To properly extract true Level-1 Tick Data (Price and Volume mapping exactly how it crossed the tape):
- Open the desired Symbol (e.g.,
ESM4). - Hit
F5to open Chart Settings. - Change
Graph Draw TypetoCandlestickorBar. - Navigate to the
Bar Periodmenu. - Change to
Number of Trades Per Bar. - Set the value to 1.
- Add
MDTGrepfromAnalysis->Studies.
When you add MDTGrep via the Studies menu, you have two primary inputs to control the logic without having to rebuild the DLL:
- Trigger Export on Full Recalc: Set to
Yesby default. This makes sure that data is explicitly written to your hard drive every time you hitEdit->Recalculateso that you don't stall your trading view looping the logic every single bid/ask tick. - Export Mode: You can select either
Time (OHLC + Vol)orTick (Price + Vol + Delta). Depending on your choice, the study automatically applies a_time.csvor_tick.csvsuffix to the file output.
MDTGrep creates the file inside your \Data\ directory (C:\SierraChart\Data\). The exported columns depend on the selected Export Mode:
unix_ts_ms(standard millisecond Unix timestamp mapped statically to the chart time)openhighlowclosevolumeask_volbid_volnum_tradesopen_interest
unix_ts_msprice(the actual traded price for that tick)volumeask_volbid_voldelta(Ask Volume - Bid Volume)num_trades
Time Mode (_time.csv)
unix_ts_ms,open,high,low,close,volume,ask_vol,bid_vol,num_trades,open_interest
1716301800000,5321.00,5321.75,5321.00,5321.50,154,82,72,98,124500
1716301860000,5321.50,5322.25,5321.25,5321.75,210,115,95,145,124530Tick Mode (_tick.csv)
unix_ts_ms,price,volume,ask_vol,bid_vol,delta,num_trades
1716301802150,5321.25,2,2,0,2,1
1716301802300,5321.00,5,0,5,-5,2