Thanks to all who caught the \\. Extra credit to Terry for seeing the
Buy=True error! ;-)

Mark

--- In [email protected], "Terry" <[EMAIL PROTECTED]> wrote:
>
> You have made an error in this line
>     if (Buy=True)
> The above does not test to see if Buy is True, but FORCES Buy to be
> True. Do this instead:
>     if (Buy == True)
> or simply:
>     if (Buy)
> Doing this now brings up an error that you can't use arrays in if()
> statement so you must change it to:
>     if (LastValue(Buy))
> Of course the above code must come AFTER your Buy = statement.
>
> Finally you need to use \\ in filenames.
>     fh = fopen( "C:\/alerts.csv", "a");
> --
> Terry
> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED]
On
> Behalf Of Mark & Jean Petereit
> Sent: Tuesday, May 02, 2006 05:13
> To: [email protected]
> Subject: [amibroker] Re: Writing "alert" file
>
> Yes, I understand that. What I'm not sure of is exactly where to
> place the code in my AFL or how to trigger it. I currently have
> something similar to the following, but it's not giving me the
> desired results:
>
> // Begin Code Snippet
> AlertIf( Buy, "", "Alert: "+Name(), 1 );
> if (Buy=True)
> {
>       fh = fopen( "C:\alerts.csv", "a");
>       if( fh )
>       {
>             fputs( Name()+","+DateTime()
> +","+Close+","+High+"\n", fh );
>             fclose(fh);
>       }
>       else
>       {
>             printf("Error opening file");
>       }
> }
> // End Code Snippet
>
> The alerts are showing up in Amibroker's alert window just fine.
But
> the alerts.csv file is never being appended.
>
>
>
> --- In [email protected], "Ara Kaloustian" <ara1@> wrote:
> >
> > if you open the file with an "a" instead of "w", AFL will append
> file
> >
> > ----- Original Message -----
> > From: "Mark & Jean Petereit" <petereits@>
> > To: <[email protected]>
> > Sent: Monday, May 01, 2006 7:49 PM
> > Subject: [amibroker] Writing "alert" file
> >
> >
> > > I know how to use fopen, fputs, fclose. But is there any trick
to
> > > programming AFL to append a line to a text file for every Alert
> that
> > > is triggered?
> > >
> > >
> > >
> > >
> > >
> > >
> > > 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
> > >
> > >
> > >
> > >
> > >
> >
>
>
>
>
>
>
>
> 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
>






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





SPONSORED LINKS
Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software Investment software


YAHOO! GROUPS LINKS




Reply via email to