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

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



PureBytes Links

Trading Reference Links

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 amibroker@xxxxxxxxxxxxxxx, "Mike" <sfclimbers@xxx> 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 amibroker@xxxxxxxxxxxxxxx, "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.
> >
>



------------------------------------

**** 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

*********************************
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> 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/