Direct export to matlab
- ユーティリティ
- Andrey Yanukovich
- バージョン: 1.1
- アップデート済み: 31 5月 2017
- アクティベーション: 5
Use this script to export the price history to MATLAB mat files from any chart. Optionally, a CSV file can be created. This script allows easily creating and verifying your trading strategy in MATLAB, for example, statistical arbitrage or pairs trading strategies.
Input parameters
- startDT: start export from this date and time. Can be '1970.01.01 00:00:00' to start from the first available date and time.
- endDT: the last date and time in the file. Can be '1970.01.01 00:00:00' to export until the most recent available date and time.
- tryDownloadHistory: try to download history if there is no corresponding history in the terminal.
- writeCSV: create CSV file as well.
Then simply open the created mat file in MATLAB. Variable name created in MATLAB corresponds to exported symbol name and timeframe. If there are special symbols in the instrument name, then they are replaced with "_".
The resulting variable has a matrix structure, where the columns are values of the corresponding parameters below:
Matlab serial date number(datenum), Open, High, Low, Close, Tick volume, Spread, Real volume.
To simplify access to corresponding time series scalar, index variables are created: itime, iopen, ihigh, ilow, iclose, itick_volume, ireal_volume. For example, they can be used to plot the chart of Close price relative to time in MATLAB (assuming EURUSD_M1 is the corresponding variable):
plot(datetime(EURUSD_M1(:, itime),'ConvertFrom','datenum')), EURUSD_M1(:, iclose));
The format of CSV file is: Date, Time, Open, High, Low, Close, Tick volume, Spread, Real volume.