Thanks Steve. That also gives me a lot to try out.
--- In [email protected], "Steve Davis" <[EMAIL PROTECTED]> wrote: > > You might notice a slowdown in the optimization performance if you > read the numbers from a file hundreds of times during the > optimization. If the performance becomes a problem, you could make use > of the actionExOptimizeSetup to read the file only once. There are > multiple ways to store the contents of the file. > > if (Status("ActionEx") == actionExOptimizeSetup) > { > Read the file here. > Possibly create the static vars here. > Possibly store the numbers in a comma separated static text string. > Possibly store the numbers in an Add-To-Composite ticker symbol. > } > > Sorry, I'm traveling and cannot give a more concrete code example > right now. > > -Steve > > > --- In [email protected], "ozzyapeman" <zoopfree@> wrote: > > > > Thanks Mike! I was dealing with the latter case. So your file > > operations code looks like it might do the trick. > > > > I will test this out. > > > > > > --- In [email protected], "Mike" <sfclimbers@> wrote: > > > > > > You are presumably generating the "stuff" code somewhere, right? > > > > > > e.g. > > > condition65 = ...stuff; > > > condition126 = ...stuff; > > > > > > Thus, they are simply suggesting that you additionally generate the > > > population of the array at the same time. > > > > > > e.g > > > count = 0; > > > > > > condition65 = ...stuff; > > > good[count++] = 65; > > > > > > condition126 = ...stuff; > > > good[count++] = 126; > > > > > > Now, when constructing your dynamic variable, iterate through the > > > array values something like this (untested): > > > > > > index = Optimize("Index", 0, 0, count - 1, 1); > > > > > > Buy = VarGet("condition" + good[index]); > > > Sell = ... > > > > > > If that is not the case, and your conditions are already in the same > > > AFL as your Buy statement, and the DLL just spits out numbers to a > > > file. Then add file operations to populate the good array (untested). > > > > > > count = 0; > > > fh = fopen("good.txt", "r"); // From DLL, single number per line > > > > > > if (fh) { > > > while(!feof(fh)) { > > > good[count++] = fgets(fh); // May need to convert to number? > > > } > > > } else { > > > printf("ERROR: file can not be found (does not exist)"); > > > } > > > > > > index = Optimize("Index", 0, 0, count - 1, 1); > > > > > > Buy = VarGet("condition" + good[index]); > > > Sell = ... > > > > > > Mike > > > > > > --- In [email protected], "ozzyapeman" <zoopfree@> wrote: > > > > > > > > When you say include file, does that only encompass other AFLs? Or > > > > could it also include a generic csv file? > > > > > > > > If it is only other AFLs, which it appears to be from the online > > > > index, then won't I still have to hand set each variable to an > > > array? > > > > Or can I just make the file a range of numbers like: > > > > > > > > 65 > > > > 126 > > > > 867 > > > > 1023 > > > > etc... > > > > > > > > Also, the online index says that using include can dramatically slow > > > > down AFL, even for a single instance. Is that still the case, or is > > > > that based on earlier AmiBroker version performance? > > > > > > > > http://www.amibroker.com/guide/afl/afl_view.php?name=%23include > > > > > > > > Thanks for any input. > > > > > > > > > >
