PureBytes Links
Trading Reference Links
|
Graham
I'm playing with this file functions at the moment
too. Just noticed that you don't close your files after opening them for
reading. Maybe this is the source of your freezing problem, too many files
open. I'm totally new to these functions, but maybe this is somewhere to
start looking
Andrew
<BLOCKQUOTE
>
----- Original Message -----
<DIV
>From:
<A title=gkavanagh@xxxxxxxxxxxxx
href="">Graham
To: <A title=amibroker@xxxxxxxxxxxxxxx
href="">AB yahoo group
Sent: Tuesday, February 17, 2004 12:47
PM
Subject: [amibroker] Write and read data
to files
I have my eod and intraday data in separate databases (actually separate
installations) and wanted to have some explore results from the eod available
for the intraday to provide alert signals. Previously I would copy the oed
results to excel, then compile the results into lines and paste to the alert
file as long lines of data. I hoped to stop needing all the copy/pasting and
make life easier for myself.
I have managed to do this but it does sometimes
freeze up during the intraday auto scan. I think this has something to do with
the reading of the data files and maybe filling up the memory cache, but am
not sure what the problem is or how to get around it. The formula for storing
the data into files and reading the data are below. For simplicity sake I have
changed the data to simple HHV and LLV as the actual results are from an
included file that is about 300 lines long.
The stored data is in individual files of 2 per
stock. Rxxx.txt for reslevel and Sxxx.txt for suplevel. (xxx = ticker
name) I tried to make all in one file but could not
get it to work.If someone can give me help with
the freezing problem and how to have all the information in a single file it
would be appreciated.
/*
Export support/resistance 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 using the AA "Settings" "n=1"
Press Scan or Explore button
by Graham Kavanagh 17 Feb 2004
*/
//#pragma nocache
//#include "C:\Program Files\AmiBroker\AFL Turning Points DWM\Trend
Identification.afl"
DailyTPTopPrice = HHV<FONT
size=2>(H<FONT
size=2>,5);
DailyTPBotPrice = LLV<FONT
size=2>(L<FONT
size=2>,5);
fres = fopen(
"C:\\Program
Files\\AmiBroker\\SupResData\\R"+<FONT
color=#0000ff size=2>Name()+<FONT
color=#8b0000 size=2>".txt", <FONT
color=#8b0000 size=2>"w"); <FONT
color=#7b7bc0 size=2>
if( fres )
{
fputs(
StrFormat<FONT
size=2>("%.4f\n",
DailyTPTopPrice), fres );
fclose( fres
);
}
fsup = fopen(
"C:\\Program
Files\\AmiBroker\\SupResData\\S"+<FONT
color=#0000ff size=2>Name()+<FONT
color=#8b0000 size=2>".txt", <FONT
color=#8b0000 size=2>"w"); <FONT
color=#7b7bc0 size=2>
if( fsup )
{
fputs(
StrFormat<FONT
size=2>("%.4f\n",
DailyTPBotPrice), fres );
fclose( fsup
);
}
Buy = <FONT color=#ff00ff
size=2>0;
Filter=<FONT color=#ff00ff
size=2>1;
AddColumn(DailyTPBotPrice,<FONT
color=#8b0000 size=2>"",<FONT color=#ff00ff
size=2>1.3);
AddColumn(DailyTPTopPrice,<FONT
color=#8b0000 size=2>"",<FONT color=#ff00ff
size=2>1.3);
<FONT face=Arial
size=3>//===================%<-----------------------------------//<FONT
color=#008000 size=2>
/*
Import support/resistance data from TXT files
One file for each stock
In the first line insert the directory they are stored, make sure the files
exist
Select your charts to export with the "Apply to" filter in AA window
Select the timeframe period using the AA "Settings" "n=1"
Press Scan
by Graham Kavanagh 17 Feb 2004
*/
Sup = fopen(
"C:\\Program
Files\\AmiBroker\\SupResData\\S"+<FONT
color=#0000ff size=2>Name()+<FONT
color=#8b0000 size=2>".txt", <FONT
color=#8b0000 size=2>"r");
SupLevel = StrToNum<FONT
size=2>(fgets<FONT
size=2>(Sup));
Res = fopen(
"C:\\Program
Files\\AmiBroker\\SupResData\\R"+<FONT
color=#0000ff size=2>Name()+<FONT
color=#8b0000 size=2>".txt", <FONT
color=#8b0000 size=2>"r");
ResLevel = StrToNum<FONT
size=2>(fgets<FONT
size=2>(Res));
Filter=<FONT color=#ff00ff
size=2>1;
AddColumn(SupLevel, <FONT color=#8b0000
size=2>"support",<FONT color=#ff00ff
size=2>1.3 );
AddColumn(ResLevel, <FONT color=#8b0000
size=2>"resist",<FONT color=#ff00ff
size=2>1.3 );
BuySig = Cross<FONT
size=2>(C<FONT
size=2>,ResLevel);
SellSig = Cross<FONT
size=2>(SupLevel,C<FONT
size=2>);
Buy = BuySig;<FONT color=#ff0000
size=2>
Sell = SellSig;<FONT color=#0000ff
size=2>
AlertIf( <FONT color=#ff0000
size=2>Buy, <FONT color=#8b0000
size=2>"", <FONT color=#8b0000
size=2>"B" + ResLevel, <FONT color=#ff00ff
size=2>1, <FONT color=#ff00ff
size=2>1+<FONT color=#ff00ff
size=2>2+<FONT color=#ff00ff
size=2>4+<FONT color=#ff00ff
size=2>8, <FONT color=#ff00ff
size=2>1 );
AlertIf( <FONT color=#ff0000
size=2>Sell, <FONT color=#8b0000
size=2>"", <FONT color=#8b0000
size=2>"S" + SupLevel, <FONT color=#ff00ff
size=2>1, <FONT color=#ff00ff
size=2>1+<FONT color=#ff00ff
size=2>2+<FONT color=#ff00ff
size=2>4+<FONT color=#ff00ff
size=2>8, <FONT color=#ff00ff
size=2>1 );
Cheers,Graham<A
href="">http://e-wire.net.au/~eb_kavan/
Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
To visit your group on the web, go to:http://groups.yahoo.com/group/amibroker/
To unsubscribe from this group, send an email to:amibroker-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
|