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

Re: [amibroker] Re: How to convert a string to non-string characters?!



PureBytes Links

Trading Reference Links

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@xxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
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 amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@xxx> 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: amibroker@xxxxxxxxxxxxxxx 
>>   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 amibroker@xxxxxxxxxxxxxxx, "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

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