How do I insert a"1/2" symbol into Text?

To add comments, please log in or register
Mike Tanton
464
Mike Tanton  

Hi guys...

Can anyone tell me how to insert a small "1/2" symbol into my Text.... 

string HalfHourSymbol = "?";
string NFP_HeadsUp = "NFP Starts in 1"+HalfHourSymbol+" hours";

...I'm struggling to work this small thing out... Thanx

Lucas Tavares
918
Lucas Tavares  
I'm really curious about how to make it, but i confess I didn't understood exactly what you want.
If it's just a message to the user, why not write half? Or use this symbol ½.
Mike Tanton
464
Mike Tanton  

Hi Lucas...

Ja... it's a funny one this... It's basically just a notification on my User Interface.... an OBJ_LABLE that changes on my GUI as per the Exchange Times... eg. London Open... NY Close etc.... but I thought I'd put in a Heads-Up for when NFP starts... but that is 13:30 GMT... hence the "1/2" symbol....

//+---------------------------------+
//| Place Market Sessions Text      |
//+---------------------------------+
void Place_Market_Session_Text()
{
Market_Session();
string name = "Rhythm_Market_Sessions";

     ObjectCreate(0,name,OBJ_LABEL,0,0,0,0,0);

         ObjectSet(name,OBJPROP_CORNER,CORNER_RIGHT_UPPER);
         ObjectSetInteger(0,name,OBJPROP_ANCHOR,ANCHOR_CENTER);
         ObjectSet(name,OBJPROP_XDISTANCE,535*ChartCoeff);         
         ObjectSet(name,OBJPROP_YDISTANCE,50*ChartCoeff); 
         ObjectSetInteger(0,name,OBJPROP_BACK,false);
         ObjectSetInteger(0,name,OBJPROP_ZORDER,100);
         ObjectSet(name,OBJPROP_HIDDEN,true); 
         ObjectSetText(name,MarketSessionText,MarketSessionTextSize,"Georgia",ModeButtonTextOFF);
}

I'd like one of the "MarketSessionText" variables to be: "NFP in 1'1/2' Hours".... Yes I know.... I should go and see someone with a long comfortable couch... what can I say..

Sorry... how did you get that symbol?

nicholi shen
2317
nicholi shen  
Mike Tanton:

Hi Lucas...

Ja... it's a funny one this... It's basically just a notification on my User Interface.... an OBJ_LABLE that changes on my GUI as per the Exchange Times... eg. London Open... NY Close etc.... but I thought I'd put in a Heads-Up for when NFP starts... but that is 13:30 GMT... hence the "1/2" symbol....

I'd like one of the "MarketSessionText" variables to be: "NFP in 1'1/2' Hours".... Yes I know.... I should go and see someone with a long comfortable couch... what can I say..

Sorry... how did you get that symbol?

Print("NFP in 1\xbd Hours");
Mike Tanton
464
Mike Tanton  
nicholi shen:

Hi Nocholi...

I don't want to 'Print' it to my Journal... I want to change the Text of an OBJ_LABEL on my chart...

nicholi shen
2317
nicholi shen  
Mike Tanton:

Hi Nocholi...

I don't want to 'Print' it to my Journal... I want to change the Text of an OBJ_LABEL on my chart...

Ok... So then use the string in your object method


#include <chartobjects/chartobjectstxtcontrols.mqh>

void OnStart() 
{
   CChartObjectLabel label;
   label.Create(0, "half", 0, 100, 100);
   label.FontSize(50);
   label.Color(clrRed);
   label.Description("Event in 1\xbd hours!");
   Sleep(3000);
}
Mike Tanton
464
Mike Tanton  
nicholi shen:

Ok... So then use the string in your object method


Thanx Nicholi... but I don't think we are on the same "page" here... I'll also never ever ever use the "Sleep" Function in my code.... The code must Run... FAST... not Sleep....but thanx anyway

nicholi shen
2317
nicholi shen  
Mike Tanton:

Thanx Nicholi... but I don't think we are on the same "page" here... I'll also never ever ever use the "Sleep" Function in my code.... The code must Run... FAST... not Sleep....but thanx anyway

I don't think you understand the code and the fact that it was a simple test script which displays the desired output on the screen for 3 seconds before exiting... anyhow if you want the ½ char then you need to add "\xbd" to your strings.

Mike Tanton
464
Mike Tanton  
nicholi shen:

I don't think you understand the code and the fact that it was a simple test script which displays the desired output on the screen for 3 seconds before exiting... anyhow if you want the ½ char then you need to add "\xbd" to your strings.

Thanx Nicholi.... that is exactly what I was looking for

To add comments, please log in or register