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

[amibroker] Re: Code needed - fopen fget - use csv file as input ?



PureBytes Links

Trading Reference Links

I started using _TRACE and find that the only number that comes back from "IndustryID() == IncludeIndustry( IndustryID() )" is 0, therefore IndustryID == 0 works, but all others fail.
Wondering if the problem is with the format of the created IDs file or the read of the IDs file ???

Any thoughts

--- In amibroker@xxxxxxxxxxxxxxx, "gmorlosky" <gmorlosky@xxx> wrote:
>
> Here is the latest code, but it still is displaying in an Explore only IndustryID() == 0.
> I did make 2 changes to the code:
> 1) flipped the StrFind parameters
> 2) expanded the Filter to include IndustryID() ==
> 3) Commentary display of printf(ID) looks like this:
> 
>  ,,0
>  ,1
>  ,2
>  ,3
>  ,4
>  ,5
>  ,6
>  ,7
>  ,8
>  ,9
>  ,10
>  ,,
> 
> 
> 
> _SECTION_BEGIN("ReadingCSV Function");
> Title = "ReadingCSV Function";
> id = 0;
> function IncludeIndustry( id )
> {
>     local ids;
>     local fh;
> 
>     ids = ",";
>     fh = fopen( "C:\\AmiBroker CSV\\ABTest.csv", "r" );
> 
>     if ( fh )
> {
>     while ( !feof( fh ) )
>     {
>         ids += fgets( fh );
>         ids += ",";
>         printf( ids );
>     }
>     fclose( fh );
> }
> //    return StrFind( "," + id + "," , ids); // original code
>     return StrFind( ids, "," + id + "," );
> }
> 
> //Filter = IncludeIndustry( IndustryID() ); // original code
> Filter = IndustryID() == IncludeIndustry( IndustryID() );
> 
> Buy = Close >= 0;
> Sell = Close == 0;
> AddColumn ( Buy,"Buy" );
> AddColumn ( Sell,"Sell" );
> AddColumn ( Close,"Close" );
> AddTextColumn( FullName(),"FullName" );
> AddColumn( id, "Id" );
> _SECTION_END();
>




------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> 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/