PDA

View Full Version : For Amibroker users (export to ASCII) to use with MTP


qitrader
04-01-2007, 12:32 PM
For those of you using Amibroker to gather data from YAHOO Historical database, I found that the following code helps export their data into ASCII so it can be easily recognized by MTpredictor EOD.

Here is the code for AB and must be copy in the Amibroker directory under Formulas.

/*
Export intraday and EOD data to TXT files
One file for each stock
In the first line insert the directory you want to save them to, make sure the directory exists
Select your charts to export with the "Apply to" filter in AA window
Select the timeframe period you want to save as using the AA "Settings"
Press Scan button
by Graham Kavanagh 05 Feb 2004
*/

fh = fopen( "c:\\Temp\\"+Name()+".txt", "w");
if( fh )
{
fputs( "Date,Time,Open,High,Low,Close,Volume \n", fh );
y = Year();
m = Month();
d = Day();
r = Hour();
e = Minute();
n = Second();

for( i = 0; i < BarCount; i++ )
{
//fputs( Name() + "," , fh );
ds = StrFormat("%02.0f%02.0f%02.0f,",
y[ i ], m[ i ], d[ i ] );
fputs( ds, fh );

ts = StrFormat("%02.0f:%02.0f:%02.0f,",
r[ i ],e[ i ],n[ i ] );
fputs( ts, fh );

qs = StrFormat("%.4f,%.4f,%.4f,%.4f,%.0f\n",
O[ i ],H[ i ],L[ i ],C[ i ],V[ i ] );
fputs( qs, fh );
}

fclose( fh );
}

/////////////////////////////////////////////

After this is done, then use Mtpredictor EOD to define the data. You will now have over 7000 stocks in the database. Or you can filter the stocks in Amibroker first by using my filtering criteria. This will filter stocks with Today 's volume > 1 Million, ATR > 1 and average 30 day volume > 500,000.

Price = Param ( " Price ", 25, 10, 1000, 5 ) ;
Today_Vol = Param ( " Today's Volume ", 1000, 100, 150000000, 1000 ) ;
AvgVol = Param ( " Average Volume ", 500, 100, 150000000, 1000 ) ;
ATRvalue = Param ( " ATR ", 1, .5, 5, .1 ) ;

Myfilter = Close > Price AND V >= Today_Vol AND EMA (V, 30) >= AvgVol AND abs (O-C) >= ATRvalue ;
//if( LastValue ( myfilter ) )
//{
//CategoryAddSymbol( "", categoryWatchlist, 0 );
//}

Filter = Myfilter ;

Buy=0;
AddColumn (C, "Close");

Hope this helps,

Matt Bowen
04-02-2007, 08:31 AM
Hi qitrader,

For those of you using Amibroker to gather data from YAHOO Historical database, I found that the following code helps export their data into ASCII so it can be easily recognized by MTpredictor EOD.

Be very careful about what you use "Yahoo Data" for... it's loaded with errors :eek:

Seriously, I could never understand the logic of someone trading real money and using "free" data? That's like buying a Mercedes S-class and putting regular grade gas in the car because you are too cheap to pay for premium (know full and well the engine requires premium gas).... 6 months later the engine blows up and the guy is at the dealership wondering what the hell happened... (you get what you pay for) ;)

When I was at Advanced GET we had our own data service and you can't fathom how much work this is to put together a "clean data" supply (and we only offered Futures).

Trust me on the data issue... all data vendors are not the same and do not provide the same open, high, low and closing prices. Most data vendors buy their data from wholesalers (like MGK) and re-package it under their own name. It's very profitable, but also very time consuming if you do it right.

Go back and read my messages on data vendors that I posted 2 years ago.
ALL DATA FEED VENDORS ARE NOT THE SAME... TRUST ME ON THIS (or you can spend several thousand hours and find out yourself)

http://www.mtptrader.com/showpost.php?p=320&postcount=1

Why do you think CQG and Bloomberg charge over $1000 per month for their RT data feeds? You get what you pay for and FREE usually means loaded with FAULTS. Think about it for a minute, it's free, so how much time and effort are they going to put into it?

qitrader
04-02-2007, 09:11 AM
Historical chart data and daily updates provided by Commodity Systems, Inc. (CSI). International historical chart data and daily updates provided by Hemscott Americas. Fundamental company data provided by Capital IQ. Quotes and other information supplied by independent providers identified on the Yahoo! Finance partner page. Quotes are updated automatically, but will be turned off after 25 minutes of inactivity. Quotes are delayed at least 15 minutes. Real-Time continuous streaming quotes are available through our premium service. You may turn streaming quotes on or off. All information provided "as is" for informational purposes only, not intended for trading purposes or advice. Neither Yahoo! nor any of independent providers is liable for any informational errors, incompleteness, or delays, or for any actions taken in reliance on information contained herein. By accessing the Yahoo! site, you agree not to redistribute the information found therein.

The EOD data is coming from CSI so I should be in good shape. But I'm glad that you gave that warning, I actually had to check who was providing data to YAHOO. Very relieved now.

moccha
04-07-2007, 01:05 PM
Works with any subscribed Metastock data. I've tried it and it works. It seems to me that MTPredictor works better with ASCII files, so I'll use this script to convert all my Metastock data format to ASCII

Steve Griffiths
04-09-2007, 06:40 AM
Hi Guys,

MTP works the same with "either" Metastock OR ASCII data formats, so either is OK.

Thanks

Steve