Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1150

 
Igor Zakharov:
indirectly through line length and font size.

Do you mean this?

bool  TextGetSize( 
   const string       text,          // строка текста 
   uint&               width,        // ширина буфера в точках 
   uint&               height        // высота буфера в точках 
   );
 
Alexey Viktorov:

Do you mean this?

but there's a font missing.

 
Roman Sharanov:

but there's a font missing.

So it should be paired with this.

bool  TextSetFont( 
   const string  name,            // имя шрифта или путь к файлу шрифта на диске 
   int           size,            // размер шрифта 
   uint          flags,           // комбинация флагов 
   int           orientation=0    // угол наклона текста 
   );

I haven't used this outside of resources, but I don't think there should be any problems.

There is a text, the name, size and font type are specified. The next line of code defines the height and width of the text. And no one is interested where to use these values next... I think so.

 
Alexey Viktorov:

So it should be paired with this

I haven't used this outside of resources, but I don't think there should be any problems.

There is text, the name, size and font type are specified. The next line of code defines the height and width of the text. And no one is interested where to use these values next... I think so.

I checked it, it works.

void TextSize( uint     &width,
               uint     &height,
               string   text, 
               string   fontName, 
               uint     flags, 
               int      fontSize, 
               int      orientation=0){
   TextSetFont(fontName,fontSize,flags,orientation);
   TextGetSize(text,width,height);
}
 

A script for checking:

//+------------------------------------------------------------------+
//|                                            Script Text Width.mq5 |
//|                                                   Copyright 2019 |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2019"
#property link      "https://www.mql5.com"
#property version   "1.00"
#property script_show_inputs

input string Text="Some text";

//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart(){
   uint w, h;
   TextSize(w,h,Text,"Courier New",FW_NORMAL,14);
   Comment(
      Text,"\n",
      "Width: ",w,"\n",
      "Height: ",h
   );
}
//+------------------------------------------------------------------+
void TextSize( uint     &width,
               uint     &height,
               string   text, 
               string   fontName, 
               uint     flags, 
               int      fontSize, 
               int      orientation=0){
   TextSetFont(fontName,fontSize,flags,orientation);
   TextGetSize(text,width,height);
}
 

Got it, thank you.

Another question, how to set the TF for real data debugging? I understand for the symbol - put it at the top of the market overview window, but whatever you do, the TF opens H1

 
Roman Sharanov:

Got it, thank you.

Another question, how to set the TF for real data debugging? I understand for the symbol - put it at the top of the market overview window, but whatever you do, the TF opens H1

Service->Settings and the symbol will not need to move anywhere...


 
What can be wrong?

I create a synthetic using the formula ask(EURUSD)-bid(EURUSD), all bars are null except the current one

 
SEM:
What am I supposed to get wrong?

I create a synthetic using the formula ask(EURUSD)-bid(EURUSD), all bars except the current one are zero

The error could be in the number of digits after the decimal point:


 
Bollinger bands breakout EA with default settings, i.e. if I do not change anything it shows losses in the tester. I changed (reduced) some of the input parameters in Value and Start columns, I did not touch Step and Stop, I don't know - it stopped trading at all, at zero. Please give me the settings or give me the set file
Reason: