[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [amibroker] Re: How To Get Two Digit Year In Exploration



PureBytes Links

Trading Reference Links

This is close to what you are looking for.  I am sure it is somewhere on
this site:

http://www.cplusplus.com/ref/cstdio/printf.html

 

-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf
Of wavemechanic
Sent: Monday, June 12, 2006 2:01 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] Re: How To Get Two Digit Year In Exploration

The format specifications should be in the MSDN section of
support.microsoft.com under printf or format specifications or %f, %g, etc. 
Somewhere in that area there is a table in which all is revealed.


----- Original Message ----- 
From: "Lester Vanhoff" <ebsn247lsm@xxxxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Monday, June 12, 2006 7:28 AM
Subject: [amibroker] Re: How To Get Two Digit Year In Exploration


>
> y = Year()%100;
>
> Thanks a lot, Graham, that's the key, it solved the problem. Can anyone 
> suggest a link with some info about "c" string formatting (all those %f, 
> %e, %g, %100, etc.)
>
> I have another question but I'll start another thread:
>
> "How to overwrite exported CSV data file"
>
> Lester
>
>
>>Graham <kavemanperth@xxx> wrote:
>>
>>  y = Year()%100;
>>
>> ds = StrFormat( "%02.f%02.f%02.f,", y[i], m[i], d[i] ); // date string
>>
>>
>> On 12/06/06, Lester Vanhoff <ebsn247lsm@xxx> wrote:
>> > > Graham> If you are wanting to export the data so you can use it in 
>> > > another package then use the export AFL rather than explorations.
>> >
>> > That's how I started but I couldn't figure out "c" code to get two 
>> > digit year so I decided to try explorations first. Here is the looping 
>> > code that generates the required data file (C:\Test\Ms_eod.csv) with 
>> > four digit year. The question is how to change the following line to 
>> > get yymmdd instead of yyyymmdd:
>> >
>> > ds = StrFormat( "%4.f%02.f%02.f,", y[i], m[i], d[i] );
>> >
>> > I tried these two options but both still give four digit year:
>> >
>> > ds = StrFormat( "%02.f%02.f%02.f,", y[i], m[i], d[i] );
>> > ds = StrFormat( "%2.f%02.f%02.f,", y[i], m[i], d[i] );
>> >
>> > Here is the full code:
>> >
>> > /****START****/
>> >
>> > folder = "C:\\Test";
>> > fmkdir( folder ); // this automatically creates the directory
>> >
>> > fh = fopen( folder + "\\" + "Ms_eod.csv", "a");
>> >
>> > if (fh)
>> > {
>> >   t = Name();
>> >   p = "D";
>> >   y = Year();
>> >   m = Month();
>> >   d = Day();
>> > for( i = 0; i < BarCount; i++ ) // loop
>> >   {
>> >   fputs( t + "," , fh );
>> >   fputs( p + "," , fh );
>> >   ds = StrFormat( "%4.f%02.f%02.f,", y[i], m[i], d[i] ); // date string
>> >   fputs( ds, fh );
>> >   qs = StrFormat("%.4f, %.4f, %.4f, %.4f, %.0f, %.0f\n", O[i], H[i], 
>> > L[i], C[i], V[i], OI[i] ); // quote string
>> >   fputs( qs, fh );
>> >   }
>> > fclose( fh );
>> > }
>> > Buy = 0; // link to "scan" button
>> >
>> > /****END****/
>
>
>
>
>
>
>
>
> 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
>
>
>
>
>
>
>
>
>
> -- 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.394 / Virus Database: 268.8.3/360 - Release Date: 06/09/06
>
> 




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