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

[amibroker] Re: Writing "alert" file



PureBytes Links

Trading Reference Links

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

Mark

--- In amibroker@xxxxxxxxxxxxxxx, "Terry" <MagicTH@xxx> 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: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] 
On
> Behalf Of Mark & Jean Petereit
> Sent: Tuesday, May 02, 2006 05:13
> To: amibroker@xxxxxxxxxxxxxxx
> 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 amibroker@xxxxxxxxxxxxxxx, "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: <amibroker@xxxxxxxxxxxxxxx>
> > 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
>






------------------------ Yahoo! Groups Sponsor --------------------~--> 
GFT Forex Trading Accounts As low as $250 with up to 400:1 Leverage. Free Demo.
http://us.click.yahoo.com/lpv1TA/jlQNAA/U1CZAA/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/