import multiple CSV files into MC Backtester

Questions about MultiCharts and user contributed studies.
User avatar
virginiatrader
Posts: 79
Joined: 05 May 2007
Location: Virginia
Has thanked: 5 times
Been thanked: 5 times

import multiple CSV files into MC Backtester

Postby virginiatrader » 16 Sep 2010

A question for the forum:

I download EOD data from Pinnacle Data. I would like to import multiple CSV files into the Backtester. Is it possible to do this?

Regards,

virginiatrader

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 489 times

Re: import multiple CSV files into MC Backtester

Postby Dave Masalov » 21 Sep 2010

Dear virginiatrader,

If you want to import multiple CSV files at once, you can use ASCII mapping feature: Quote Manager --> File --> Map ASCII.

Please note that ASCII mapping is not the same as import. When you do import, the data is actually saved to your database. When you map ASCII files, the data is not imported, the files are simply linked to the database.

User avatar
virginiatrader
Posts: 79
Joined: 05 May 2007
Location: Virginia
Has thanked: 5 times
Been thanked: 5 times

Re: import multiple CSV files into MC Backtester

Postby virginiatrader » 21 Sep 2010

Dave:

Thanks for the reply. I am familiar with the ASCII mapping and data import features. My desire was to import the CSV file “names” without hand-jamming each individual one. I needed to import 84 files representing data on currency pairs, and worked out a method, done with simple computer commands and Microsoft Excel, which follows…

The computer commands:

Open a command prompt

Change directory with the cd command to get into the directory you want to read. Then type this command:

dir > “mylistname”.txt (leave out the quotation marks!)

The "dir" command will read the current directory.

Then the ">" (greater-than sign) tells "dir" to redirect its output to the file name that follows.

"myfilelist.txt" is whatever name you choose for the file that will receive the directory listing.

My usage:
c:\users\tim d:
D: cd data\forex
D:\data\forex dir > forexlist.txt

The output file now appears in my D:\DATA\FOREX folder. A sample of the CSV files in the list…

AUDCAD.CSV
AUDCHF.CSV
AUDGBP.CSV

The import:

I imported the text file into Excel, and executed CTRL-F to find and replace the .CSV extension on all the file names with a blank space. AUDCAD.CSV became AUDCAD. I then saved the modified file as a CSV file of its own called FOREXFILELIST.CSV. I scrubbed the list for my desired currency pairs, and re-saved the file.

At this point, I opened the MC Portfolio Backtester, went to the left pane, expanded “Strategy1”, right-clicked on “Instruments”, selected “Import Instruments List”, and navigated to the location of my file FOREXFILELIST.CSV. The import went as expected, and since the ASCII data was already mapped, the task was complete, and the FOREX portfolio ready for backtesting.

Life is good with MultiCharts!

virginiatrader
Attachments
BacktesterScreenShot.jpg
MC BacktesterScreenShot
(207.58 KiB) Downloaded 563 times

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 489 times

Re: import multiple CSV files into MC Backtester

Postby Dave Masalov » 22 Sep 2010

Dear virginiatrader,

Glad to hear that you have found the way to do what you need.


Return to “MultiCharts”