Since I can only guess, I could be wrong but if I was writing the dll, I would build up a table of substrings, have pointers to those strings based on input conditions, In addition, to a table of substring, I can add a table of pointers to equivalent function, and call them as well based on the same conditions that led to the generation of those strings.
--- In [email protected], "ozzyapeman" <[EMAIL PROTECTED]> wrote: > > Thanks but I would still need to first convert output to AFL from the > string. The expressions are dependent on the arrays within AB. > > The only workaround would be to one day program the whole thing in > AFL. But I think that offloading it to a C++ program was the way to > go, as it is runs as compiled code, quite fast. > > And by dynamically writing strings to the include file, I am hoping it > will still be speedy. Will know in a few days after reworking the DLL > and testing. > > > --- In [email protected], "Paul Ho" <paul.tsho@> wrote: > > > > Since the strings are generated from the dll, presumably from a set of > > tokens, Depending on how it is written, the logic used in writing > the string > > can be extended to evaluate the string as well. why dont you ask the > > programmer to do that. > > > > > > On Thu, Nov 27, 2008 at 12:52 PM, ozzyapeman <zoopfree@> wrote: > > > > > Thanks again, TJ. I had not even considered dynamically writing > to an > > > include file. That might do it. > > > > > > Since I already paid to have the DLL coded, and it outputs strings, a > > > small modification will allow it to output both the left AND right > > > side of the variable expression. > > > > > > Then for each optimization step, I will have the formula FPUT to the > > > include file, then read back from that file - and thus cycle through > > > thousands of expressions with only a SINGLE expression in my main > formula. > > > > > > Yes, the expressions are already generated from functions, but in C++. > > > I thought it would run faster that way, rather than trying to code it > > > all in AFL - hence the DLL. The examples I gave were substitutions for > > > the real expressions, which are much more complex. > > > > > > --- In [email protected] <amibroker%40yahoogroups.com>, > "Tomasz > > > Janeczko" <groups@> wrote: > > > > > > > > The point is that you don't need to include thousands of > expressions > > > > but only ONE ! > > > > If you change the CONTENT of include file dynamically by writing TO > > > the file you can > > > > have dynamic expression evaluation. > > > > And all that without any DLL. > > > > > > > > Also it all really depends on what you are specifically trying > to do. > > > > General descriptions lack clarity. You need to provide ENTIRE idea > > > with details > > > > if you want help. Otherwise people are guessing what you are trying > > > to do. > > > > > > > > For example if you want to SWITCH between different conditions in > > > run time > > > > the SWITCH structure gives fastest execution: > > > > > > > > switch( n ) > > > > { > > > > case 1: > > > > result = MA(C, 12) > C5 AND MA(C,20) < Close; > > > > break; > > > > case 2: > > > > result = MA(H, 50) < C12 AND EMA(L, 12) < Close; > > > > break; > > > > default: > > > > break; > > > > } > > > > > > > > > > > > It is fast because on ONE of Nth expressions will be actually > evaluated. > > > > > > > > There are other techniques that lead to compact and fast formula > > > > but it ALL depends on details on what exactly you want to do. > > > > For example I can see that your expressions are repeated with only > > > > minor fluctuations (replacing C with H) and that can be easily > wrapped > > > > into functions / switch statements provided one has clear idea > > > > and knows what he wants to achieve and prepares plan for that. > > > > > > > > The general rule is first THINK a lot before writing the very first > > > line of code. > > > > If you begin with just typing thousands of lines of code without > > > planning first you end up with spaghetti. > > > > > > > > Best regards, > > > > Tomasz Janeczko > > > > amibroker.com > > > > ----- Original Message ----- > > > > From: "ozzyapeman" <zoopfree@> > > > > To: <[email protected] <amibroker%40yahoogroups.com>> > > > > Sent: Thursday, November 27, 2008 1:07 AM > > > > Subject: [amibroker] Re: How to convert a string to non- string > > > characters?! > > > > > > > > > > > > > Thanks, TJ. Looks like I am back at square one. I contracted > to have > > > > > the DLL coded because pasting the thousands of expressions at once > > > > > into the formula slowed down AB considerably. Most of the time it > > > > > hung. So I was trying to generate the expressions dynamically. > > > > > > > > > > Correct me if I am wrong, but wouldn't the #include function > result in > > > > > overall execution that is slower than pasting the thousands of AFL > > > > > expressions directly into the formula? > > > > > > > > > > Or will it actually be faster than a copy and paste? > > > > > > > > > > In some cases I am trying to evaluate tens of thousands of > full blown > > > > > AFL expressions per formula. > > > > > > > > > > > > > > > --- In [email protected] <amibroker% 40yahoogroups.com>, > > > "Tomasz Janeczko" <groups@> wrote: > > > > >> > > > > >> Hello, > > > > >> > > > > >> You need to understand that you are attempting to PARSE > expressions. > > > > >> > > > > >> The only way to parse actual full-blown AFL expressions is to > > > > > INCLUDE them > > > > >> in the formula. > > > > >> > > > > >> If you want to "create" expressions on the fly AND execute them, > > > > >> you need to take two step approach > > > > >> a) create TEXT file with actual expressions you want to parse > > > > >> b) #include that text file > > > > >> > > > > >> #pragma nocache > > > > >> #include "the_file_with_the_expressions_to_parse" > > > > >> > > > > >> in the actual formula and run it. > > > > >> > > > > >> Best regards, > > > > >> Tomasz Janeczko > > > > >> amibroker.com > > > > >> ----- Original Message ----- > > > > >> From: "ozzyapeman" <zoopfree@> > > > > >> To: <[email protected] <amibroker% 40yahoogroups.com>> > > > > >> Sent: Thursday, November 27, 2008 12:38 AM > > > > >> Subject: [amibroker] Re: How to convert a string to non- string > > > > > characters?! > > > > >> > > > > >> > > > > >> > TJ, > > > > >> > > > > > >> > Thanks, quick question: > > > > >> > > > > > >> > I gave the arithmetic expression as a quick trivial example. > > > But what > > > > >> > I really want to do is create and evaluate expressions of > the type: > > > > >> > > > > > >> > Condition1 = MA(C, 12) > C5 AND MA(C,20) < Close; > > > > >> > > > > > >> > so for the above case, would you also recommend writing a > > > > >> > parser/interpreter - or did you suggest that purely for > arithmetic > > > > >> > expressions like "1 + 2 + 3"? > > > > >> > > > > > >> > > > > > >> > --- In [email protected] <amibroker% 40yahoogroups.com>, > > > "Tomasz Janeczko" <groups@> > > > wrote: > > > > >> >> > > > > >> >> You do not want to convert from string to number. > > > > >> >> What you really want is to EVALUATE arithmetic expressions ! > > > > >> >> For that you need to either write parser/interpreter or use > > > > >> > external onee > > > > >> >> Thanks to AmiBroker JScript support you can use for example > > > JScript > > > > >> > eval function. > > > > >> >> > > > > >> >> > > > > >> >> EnableScript("JScript"); > > > > >> >> <% > > > > >> >> > > > > >> >> %> > > > > >> >> > > > > >> >> function Evaluate( text ) > > > > >> >> { > > > > >> >> so = GetScriptObject(); > > > > >> >> return so.eval( text ); > > > > >> >> } > > > > >> >> > > > > >> >> "The result is " + Evaluate("3 + 2"); > > > > >> >> > > > > >> >> Best regards, > > > > >> >> Tomasz Janeczko > > > > >> >> amibroker.com > > > > >> >> ----- Original Message ----- > > > > >> >> From: ozzyapeman > > > > >> >> To: [email protected] <amibroker% 40yahoogroups.com> > > > > >> >> Sent: Wednesday, November 26, 2008 11:46 PM > > > > >> >> Subject: [amibroker] Re: How to convert a string to non-string > > > > >> > characters?! > > > > >> >> > > > > >> >> > > > > >> >> Or to take a more trivial example, the following prints "3" > > > > >> > instead of "12": > > > > >> >> > > > > >> >> VarSetText("Condition1", "3 + 4 + 5"); > > > > >> >> > > > > >> >> Total = StrToNum (VarGetText("Condition1")); > > > > >> >> > > > > >> >> printf ("Sum %g", Total); > > > > >> >> > > > > >> >> How do I convert the above string so that Total is equal > to the > > > > >> > expression itself, which is equal to 12? > > > > >> >> > > > > >> >> > > > > >> >> --- In [email protected] > <amibroker%40yahoogroups.com>, > > > "ozzyapeman" <zoopfree@> > > > wrote: > > > > >> >> > > > > > >> >> > Yes, tried that. But since the values spit out by the > function > > > > >> > aren't > > > > >> >> > just pure numbers, it does not seem to work. > > > > >> >> > > > > > >> >> > > > > >> > > > > > >> > > > > > >> > > > > > >> > ------------------------------------ > > > > >> > > > > > >> > **** 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 > > > > >> > > > > > >> > > > > > >> > > > > > >> > > > > > > > > > > > > > > > > > > > > ------------------------------------ > > > > > > > > > > **** 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 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
