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

Re: [amibroker] Re: Looping or optimizing a set of non sequential numbers?



PureBytes Links

Trading Reference Links

Title: Re: [amibroker] Re: Looping or optimizing a set of non sequential numbers?

I don't see any fclose()... you must close the file after access. 


herman



Tuesday, November 25, 2008, 12:46:49 AM, you wrote:


>

Hey Guys,


Hoping anyone can still chime in on this problem. I got the following code to work. However, if my text file contains, say, 5,000 numbers (each on a separate line), the AFL only seems to recognize the first 2,988. I've tried different text files of varying sizes and it seems that for any files bigger than 3,000 numbers, the AFL only captures less than 3,000, e.g 2,843 ... 


For smaller files, like 1650 numbers, the AFL captures all the numbers as it should.


Is there some limit in AmiBroker that is causing this? Or is there a flaw in this test code somewhere:


Count = 0;


if(Status("ActionEx") == actionExOptimizeSetup)

{

count = 0;

fh = fopen("c:\\TestExtractFile03.txt""r"); 


if (fh) 

{

  while(!feof(fh)) 

  {

  StaticVarSet("Row"+NumToStr(Count,1.0,0), StrToNum(fgets(fh)) ); 

  StaticVarSet("Count", Count);  

  Count++;  

  }

fclose( fh );

>


>

else 

  {

   printf("ERROR: file can not be found (does not exist)");

  }  

}



b = Optimize("b"91, Count, 1);


Count = StaticVarGet("Count");


for(a = 0; a < Count; a++)

{

Row = StaticVarGet("Row"+NumToStr(a,1.0,0));

printf("Row: %g\n", Row );

}


Buy  = a == 12// random buy/sell conditions for test purposes

Sell = a == 2;








--- In amibroker@xxxxxxxxxxxxxxx, "Mike" <sfclimbers@xxx> wrote:

>

> Hi,

> Sorry for the absence. Looks like others have helped you out. As for 

> your last question, the %g is as described in the link provided by 

> AB. The \n is not associated with the % token at all, but rather is 

> just part of the string being printed and is an escape character 

> representing a "newline". Other similar characters are \t for tab, 

> etc.

> http://msdn.microsoft.com/en-us/library/h21280bw(VS.80).aspx

> Mike

> --- In amibroker@xxxxxxxxxxxxxxx, "ozzyapeman" zoopfree@ wrote:

> >

> > Thanks! That finally works.

> > 

> > One follow-up question on these printf special characters, like "%

> g\n".

> > 

> > Where can I find more info on these? The AmiBroker help guide points

> > me to the following microsoft page. But the definitions there 

> for "g"

> > don't seem to match.

> > 

> > http://msdn.microsoft.com/en-us/library/hf4y5e3w(VS.80).aspx

> > 

> > Also, in the AB help guide, they give an example of %gn without the 

> \.

> > But in the snippet below, you use a \. 

> > 

> > I can't seem to find any other explanations in the help guide for

> > these special characters.

> > 

> > 

> > 

> > --- In amibroker@xxxxxxxxxxxxxxx, "tuzo_wilson" <j.tuzo.wilson@> 

> wrote:

> > >

> > > --- In amibroker@xxxxxxxxxxxxxxx, "ozzyapeman" <zoopfree@> wrote:

> > > >

> > > > Thanks on the Count++. It's an improvement. But I still get 

> wrong

> > > results:

> > > 

> > > Oops...don't increment before writing out your data:

> > > 

> > > good[count] = StrToNum(fgets(fh));

> > > printf("Number: %g\n", good[count] ); 

> > > count++;

> > > 

> > > That should work.

> > > 

> > > 

> > > Tuzo

> > >

> >

>

 

__._,_.___

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

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

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

For other support material please check also:
http://www.amibroker.com/support.html

*********************************




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___