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

[amibroker] Amibroker Yahoo Website ???



PureBytes Links

Trading Reference Links

Thanks for the help everyone. I ended up using fputs(), etc. and 
#include in one script to write the following to a file. The 
following code sets up a reference file.

//---------------------------------------
p1=Param("1) S/T Period",20,3,373,1);
p2=Param("2) I/T Period",50,3,373,1);
p3=Param("3) L/T Period",144,3,373,1);
periods="p1="+NumToStr( p1, 3.0, False)+";"+"p2="+NumToStr( p2, 3.0, 
False)+";"+"p3="+NumToStr( p3, 3.0, False)+";";
fileperiods=fopen("Periods.txt","w");
if(fileperiods)
{
fputs( periods, fileperiods ); 
fclose( fileperiods ); 
}
//---------------------------------------

The contents of the file 'Periods.txt' after being set with 
the 'param' commands above:

p1= 24;p2= 35;p3= 85;

Then I simply use the #include command to link all the other charts 
that I want to use these periods with.

Thanks for the help.

-ace

--- In amibroker@xxxxxxxxxxxxxxx, "PeterJ \(wpq\)" 
<pjcwebpagequery@xxxx> wrote:
> Ace
>  
> This is what I ended up using.
>  
> Make sure you close your files ASAP after using them both when 
reading and
> writing to avoid 'difficult-to-de-bug' problems :-))
>  
> good luck
> PeterJ
>  
>  
> ========WRITING=============================
>  
> /// your custom AFL code to determine your variable goes here, 
EMAparam
>  
> //// save EMAparam value for use by other indicator windows
> fh = fopen("EMAparam.txt", "w");
> if(fh)
> {
>  fputs( NumToStr(EMA,1.0,False), fh);
>  fclose(fh); // write to disk
> }
> else
> {
>  printf("Error opening EMAparam.txt");
> }
>  
> /// balance of your code......
>  
> 
> ========READING=============================
>  
> /// to read in stored parameter use this code
>  
> //// get EMA param value from txt file
> EMAparam = 1; // initialise
> fh = fopen("EMAparam.txt", "r");
> if(fh)
> {
>  while(NOT feof(fh))
>  {
>   EMAparam = StrToNum( fgets(fh) ); // read EMAparam
>  }
>  fclose(fh);
> }
> else
> {
>  printf("Error opening EMAparam.txt");
> } 
>  
> /// etc
>  
> 
> -----Original Message-----
> From: dingo [mailto:dingo@x...] 
> Sent: Tuesday, 24 February 2004 3:07 p
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: RE: [amibroker] File Reading/Writing
> 
> 
> Yes - check out the posts around 1/28/2004 with subject of "Can AB 
pass
> parameter values between indicators?" 
>  
> Make sure the read the one on 2/5/2004 for the  final solution.
>  
> d
> 
> 
>   _____  
> 
> From: acesheet [mailto:acesheet@x...] 
> Sent: Monday, February 23, 2004 10:53 PM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] File Reading/Writing
> 
> 
> Can fputs and fgets, et al only be used in AA AFL scripts or is 
> there some way to trigger it in Indicator Builder?
> 
> I'm looking for a way to link several Indicator Builder scripts 
> together so they use the same lookback period.
> 
> I hoped I could write the period sto a file and then read them out 
> of the file in the other windows. Has anyone tackled the problem 
of 
> linking several indicator windows together?
> 
> Thanks.
> 
> -ace



Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.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/