Re: [amibroker] Re: How to convert a string to non-string characters?!Yes I can 
see the same but surprisingly duplicates apparently arrive only
by e-mail, and don't appear on the web
http://finance.groups.yahoo.com/group/amibroker/messages/

Will need to put sender onto "Moderated" queue, maybe it will help stopping the 
loop.


Best regards,
Tomasz Janeczko
amibroker.com
  ----- Original Message ----- 
  From: Herman 
  To: Barry Scarborough 
  Sent: Thursday, November 27, 2008 5:54 PM
  Subject: Re: [amibroker] Re: How to convert a string to non-string 
characters?!


  Is everybody getting this same email about twenty times? They are still 
coming in... but less frequently.




  or is this a problem at my end?




  h







  Wednesday, November 26, 2008, 7:42:31 PM, you wrote:




  > It isn't impossible, just akward. I would try to find another way. 




  > StrToNum will convert the number up to the first non-number, the  

  > character + in your case. That is why you get 3 instead of 12.

  > 3 + 4 + 5 is not a number and strToNum is not smart enough to add the 

  > numbers. When it gets to the + it quits and returns 3.




  > To sum numbers in a string you have to parse the string to extract 

  > the numbers. This will extract the numbers from the string and sum 

  > them. The printf lines show what is being done along the way.




  > VarSetText("Condition1", "3 + 4 + 5");

  >  

  > aStr = VarGetText("Condition1");

  > a = aStr;

  > Offset = StrFind(aStr, "+") +1;

  > Len = StrLen(aStr);

  > b = StrMid(aStr, Offset, Len);

  > Offset = StrFind(b, "+") +1;

  > Len = StrLen(b);

  > d = StrMid(b, Offset, Len);




  > // this shows the output of the parser

  > // at this point a, b and d are strings, not numbers.

  > printf("a= " + a + ", b= " + b + ", d= " + d);




  > // strToNum returns the number up to first text character

  > x = StrToNum(a); // x = 3

  > y = StrToNum(b); // y = 4

  > z = StrToNum(d); // z = 5




  > // now you can sum the numbers

  > printf("\nTotal =" + NumToStr(x+y+z, 1)); 




  > Of course if you have an alphanumeric string, such as "Sum 3 plus 4 

  > and  then add 5.", the parsing it will get very difficult but it can 

  > be done.   




  > Barry




  > --- In [email protected], "ozzyapeman" <[EMAIL PROTECTED]> wrote:




  >> If it is just plain impossible to convert strings to actual values

  >> (other than plain numbers), perhaps my DLL plugin needs to spit 

  > work in

  >> a different way?




  >> This is the type of thing I am trying to achieve - to cycle through

  >> thousands of conditions like:




  >> Condition1    = MA(C, 12) > C5  AND MA(C,20)    < Close;

  >> Condition2    = EMA(L,4)  > C3  OR  MA(H,7)     > Close;

  >> .

  >> .

  >> .

  >> Condition2555 = MA(H, 50) < C12 AND  EMA(L, 12) < Close;







  >> Setting the left sides of the above expressions is easy, using 

  > dynamic

  >> variables.




  >> But my DLL spits out the right sides of the above expressions, but 

  > only

  >> as strings. So instead of the DLL returning strings, how else could 

  > it

  >> interface with AmiBroker so that the dynamic assignments above are

  >> created in the AFL?













  >> --- In [email protected], "ozzyapeman" <zoopfree@> wrote:

  >> >

  >> > 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], "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




  >     http://groups.yahoo.com/group/amibroker/




  >     Individual Email | Traditional




  >     http://groups.yahoo.com/group/amibroker/join

  >     (Yahoo! ID required)




  >     mailto:[EMAIL PROTECTED] 

  >     mailto:[EMAIL PROTECTED]




  >     [EMAIL PROTECTED]




  >     http://docs.yahoo.com/info/terms/







   

Reply via email to