Help-me decimal numbers

 
good night

Help me please to finish an indicator code, because after all programmed, when the information appears in the graphic appears the values thus 0.12345678, and I want it to be 0.1234 or 0.12, what encoding should I put? and where you want?

It would be possible to prepare the encoding for the user to select if 0.1234 or 0.12?

thanks for help
Files:
 
sextafeira wrote >>
good night

Help me please to finish an indicator code, because after all programmed, when the information appears in the graphic appears the values thus 0.12345678, and I want it to be 0.1234 or 0.12, what encoding should I put? and where you want?

It would be possible to prepare the encoding for the user to select if 0.1234 or 0.12?

thanks for help

Please check https://docs.mql4.com/convert/DoubleToStr

 
ok

but where you put this text in order to take effect ?
and how to put the function extern int, so that you can select 0.0000 or 0.00)
could help me with this example file attached I send?
Files:
 

sextaefira - you've been given a good answer by brother3th.

You need to do a little work yourself. Sounds like you ought to do a little reading of the mql4 documentation.

If you'd bothered to do that, you wouldn't need to ask the question you just asked.


"Help me please to finish an indicator code, because after all programmed" - You tell us you can drive a car.

"0.12345678, and I want it to be 0.1234 or 0.12" - You ask for specific directions.

"Please check https://docs.mql4.com/convert/DoubleToStr" - You are given correct directions.

"but where you put this text in order to take effect ? and how to put the function extern int, so that you can select 0.0000 or 0.00" - Now you ask "how do I get in the car and where do I sit".


Start here:

https://book.mql4.com/basics/index


Hope this helps.


CB

 
thanks for trying to help but ...., I am not able,
as already tested this code and nothing changes, possibly because it is misplaced.

If there's someone who can help me, thank
 
thanks for trying to help but ...., I am not able,
as already tested this code and nothing changes, possibly because it is misplaced.

If there's someone who can help me, thank
where put this code?
string value=DoubleToStr(1.28473418, 5);
// the value is "1.28473"
to work in graphic 1.1234
#property indicator_chart_window
//---- input parameters
extern int ExtParam1;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
//----

int counted_bars=IndicatorCounted();
//----
double ld_1 ;
double l_iopen_4 = iOpen(Symbol(), 0, 1);
ld_1 = l_iopen_4;

ObjectCreate("buy", OBJ_LABEL, 0, 0, 0);
ObjectSet("buy", OBJPROP_XDISTANCE, 350);
ObjectSet("buy", OBJPROP_YDISTANCE, 20);
ObjectSetText("buy", "BUY : " + ld_1, 11, "Times New Roman", Lime);
//----
return(0);
}
//+------
 
//ObjectSetText("buy", "BUY : " + ld_1, 11, "Times New Roman", Lime);
ObjectSetText("buy", "BUY : " + DoubleToStr(ld_1,Digits), 11, "Times New Roman", Lime);
 
I have to change it? because it keeps all the same
 

is OK : )

Reason: