PureBytes Links
Trading Reference Links
|
move the IF into the loop rather than before it
On 4/21/05, Lesmond V <ebsn247@xxxxxxxx> wrote:
>
>
> Here is another version of Graham's code. It will export the data
> to:
>
> C:\MS_Data\MS_Eod.csv
>
> in the following format:
>
> Ticker,P,Date,Open,High,Low,Close,Volume,OpenInterest
> $SPX,D,2005/04/18,1142.8700, 1148.9200, 1139.8000, 1145.9800, 0, 0
> $SPX,D,2005/04/19,1148.7000, 1154.6700, 1148.3000, 1152.7800, 0, 0
> $SPX,D,2005/04/20,1153.7200, 1155.5000, 1136.1500, 1137.5000, 0, 0
>
> To run the code:
>
> go to AA - ApplyTo:set Filters - Range:disregard - Scan
>
> Problem:
>
> If you set the "filter" to let's say a watch list, only the last
> symbol from the WL will be exported (with Scan button) and only the
> first symbol with Explore button. The same applies to Graham's code
> from the previous post. Any ideas how to resolve this are
> appreciated.
>
> /***************
> Export Eod Data To Metastock
> Based on Graham Kavanagh's code:
> http://www.amibroker.com/library/detail.php?id=327&hilite=fputs
>
> 1) Execution: AA - ApplyTo:set Filters - Range:disregard - Scan
> 2) There is no option to set the date range (AA "Range" is not linked
> to this formula)
> 3) The code exports data of the current ticker to
> C:\MS_Data\MS_Eod.csv
> 4) If the directory doesn't exist it will be created automatically
> ***************/
>
> folder = "C:\\MS_Data";
> fmkdir( folder );
>
> fh = fopen( folder + "\\" + "MS_Eod.csv", "w");
> if (fh)
> {
> fputs( "Ticker,P,Date,Open,High,Low,Close,Volume,OpenInterest\n",
> fh );
> t = Name();
> p = "D";
> y = Year();
> m = Month();
> d = Day();
> for( i = 0; i < BarCount; i++ )
> {
> fputs( t + "," , fh );
> fputs( p + "," , fh );
> ds = StrFormat("%02.0f/%02.0f/%02.0f,", y[i], m[i], d[i] );
> fputs( ds, fh );
> qs = StrFormat("%.4f, %.4f, %.4f, %.4f, %.0f, %.0f\n", O[i],
> H[i], L[i], C[i], V[i], OI[i] );
> fputs( qs, fh );
> }
> fclose( fh );
> }
> Buy = 0;
>
> /***************/
>
> Lesmond
>
> --- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxxx> wrote:
> > I can only suggest you add in an extra column and have it add the
> > letter you want
> >
> > You could always write an exploration and export the results from
> AA window
> >
> > I have assumed this is what you are loking for
> > Here is sample of altered code to add in a D or X for daily or other
> >
> > x = "C:\\IDData"+ WriteVal(Now(3),1);
> >
> > fmkdir( x );
> >
> > Buy=V>0;
> >
> > if( Interval()==inDaily ) {dt = "D";}
> > else{ dt = "X" ;}
> >
> >
> > fh = fopen( x + "\\" +Name()+".txt", "w");
> > if( fh )
> > {
> > fputs( "Ticker,Timeframe,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++ )
> > {
> > if( Buy[i] )
> > {
> > fputs( Name() + "," , fh );
> > ds = StrFormat("%02.0f-%02.0f-%02.0f,",
> > y[ i ], m[ i ], d[ i ] );
> > fputs( ds, fh );
> > fputs( dt + "," , 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 );
> > }
> >
> >
> >
> > On 4/21/05, Rakesh Sahgal <rakeshsahgal@xxxx> wrote:
> > >
> > > Hi Graham
> > >
> > > I want to use the code you shared with the group to
> > > export data to MS Format for use in MS.
> > >
> > > To be able to convert the data I need to indicate the
> > > periodicity of the data in each line of data in the
> > > file. The periodicity will be indicated by the letter
> > > "D" indicating daily data inserted between the ticker
> > > and date fields. Can you please guide me through this?
> > >
> > > TIA
> > >
> > > Regards
> > >
> > > Rakesh
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Tired of spam? Yahoo! Mail has the best spam protection around
> > > http://mail.yahoo.com
> > >
> > >
> > > Please note that this group is for discussion between users only.
> > >
> > > To get support from AmiBroker please send an e-mail directly to
> > > SUPPORT {at} amibroker.com
> > >
> > > For other support material please check also:
> > > http://www.amibroker.com/support.html
> > >
> > >
> > > Yahoo! Groups Links
> > >
> > >
> > >
> > >
> > >
> >
> >
> > --
> > Cheers
> > Graham
> > http://e-wire.net.au/~eb_kavan/
>
>
> Please note that this group is for discussion between users only.
>
> To get support from AmiBroker please send an e-mail directly to
> SUPPORT {at} amibroker.com
>
> For other support material please check also:
> http://www.amibroker.com/support.html
>
>
> Yahoo! Groups Links
>
>
>
>
>
--
Cheers
Graham
http://e-wire.net.au/~eb_kavan/
------------------------ Yahoo! Groups Sponsor --------------------~-->
In low income neighborhoods, 84% do not own computers.
At Network for Good, help bridge the Digital Divide!
http://us.click.yahoo.com/EpW3eD/3MnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~->
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.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:
http://docs.yahoo.com/info/terms/
|