How do I convert character to ANSI number

Back to topics list  | 1 2 To post a new topic, please log in or register
avatar
13000
WHRoeder 2015.09.04 22:49 #
 
Never to that because they are unreadable.
 if(ArrowProp="ò")ArrowNo=Down;
 if(ArrowProp="ö")ArrowNo=Sideways;
 if(ArrowProp="ñ")ArrowNo=Up;
This you can
if(ArrowProp == "\242")ArrowNo=Down;
if(ArrowProp == "\240")ArrowNo=Sideways;
if(ArrowProp == "\241")ArrowNo=Up;

// or

if(ArrowProp == "\xF2")ArrowNo=Down;
if(ArrowProp == "\xF0")ArrowNo=Sideways;
if(ArrowProp == "\xF1")ArrowNo=Up;
Character Constants - MQL4 Documentation
Or even easer
ArrowNo = StringGetCharacter(ArrowProp, 0);
StringGetCharacter - MQL4 Documentation

avatar
58
Mike.T 2015.09.05 10:21 #
 

Thanx Roeder

That is what I was looking for....

ArrowNo = StringGetCharacter(ArrowProp, 0);

 I've also taken note of....

if(ArrowProp == "\242")ArrowNo=Down;
if(ArrowProp == "\240")ArrowNo=Sideways;
if(ArrowProp == "\241")ArrowNo=Up;

// or

if(ArrowProp == "\xF2")ArrowNo=Down;
if(ArrowProp == "\xF0")ArrowNo=Sideways;
if(ArrowProp == "\xF1")ArrowNo=Up;

 Thanx...

avatar
58
Mike.T 2015.09.05 14:47 #
 
Mike.T:

Sorry Demos.... you were right all along with StringGetCharacter... I just wasn't using  it correctly.... I should have paid more attention...heheh

The final solution...

void OnTick()
  {
//---


//---
string ArrowProp = ObjectDescription("TrendArrowHTF"); //Get Object text value
string ArrowNo = StringGetCharacter(ArrowProp, 0);
   
   Comment("Arrow No = ",ArrowNo);
   
  }

 Easy when you know how....

Thanx Guys 

Back to topics list   | 1 2  

To add comments, please log in or register