Errors, bugs, questions - page 2975

 
Andrii Djola:
Greetings all, such a question why SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_VALUE) returns 0?

PCM on the symbol in Market Watch, Specification. Looked it up, there isn't this parameter there.

 

Comment outputs completely different lengths (visually) for exactly the same length

Comment

Code:

void OnStart() {
  string str[5], res="";
  StringInit(str[0], 50, 'a');
  StringInit(str[1], 50, 'X');
  StringInit(str[2], 50, '=');
  StringInit(str[3], 50, ' ');
  StringInit(str[4], 50, ':');
  for (int i = 0; i < 5; i++) 
    res += str[i] + "\n";
  Comment(res);
}

How can you output lines withComment so that they are visually the same length? For example, I want to output a table of three columns so that the columns are exactly vertical.

 
Mihail Matkovskij:

Comment outputs completely different lengths (visually) for exactly the same length

Code:

How can you output lines withComment so that they are visually the same length? For example, I want to output a table that has three columns so that the columns are equally spaced vertically.

monospaced font

 
Valeriy Yastremskiy:

monospaced font

Only, unfortunately, the font for Comment does not change. It uses the system font, no options. I found this out later in the forum. So we'll have to make do with labels.

 
Mihail Matkovskij:

Only, unfortunately, the font for Comment does not change.

You could swap the system font. but yes, it's better to make a self-made one.

 
Mihail Matkovskij:

Comment outputs completely different lengths (visually) for exactly the same length

Code:

How can you output lines withComment so that they are visually the same length? For example, I want to output a table that has three columns so that the columns are equally spaced vertically.

Forum on trading, automated trading systems and strategy testing

Indicators: ClosingLots

Alexey Viktorov, 2019.03.08 17:58

The indicator is almost completely rewritten. Now its code can be used as a sample for working with OBJ_BITMAP_LABEL and resources.

Of course, it's not cartoons using iCanvas Nikolai Semko, but it's better than using simple OBJ_LABEL


 
Alexey Viktorov:

This indicator has the same principle as the canva. It also works based on OBJ_BITMAP_LABEL. And I have some developments on the basis of canvas. But this method requires constant resource refreshing which is not very good for the application's performance, if the text is often displayed. And I have a very resource-intensive application. But it spends resources on a payload. So, the label variant seems to me the most economical in terms of CPU resource consumption.

Документация по MQL5: Константы, перечисления и структуры / Константы объектов / Типы объектов
Документация по MQL5: Константы, перечисления и структуры / Константы объектов / Типы объектов
  • www.mql5.com
Типы объектов - Константы объектов - Константы, перечисления и структуры - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
Mihail Matkovskij:

Only, unfortunately, the font for Comment does not change. It uses the system font, no options. I found this out later on the forum. So we'll have to make do with labels.

If you're not squeamish about other people's Bibles, you can use this example:
 
Nikolai Semko:
If you're not squeamish about other people's bibbles, you can use this example:

Thank you! The indicators on iCanvas are impressive. But it's still the same Canvas with all the above disadvantages.

 
Mihail Matkovskij:

Thank you! The indicators on iCanvas are impressive. But it's still the same Canvas with all the above disadvantages.

Which disadvantages are you talking about?
About resource intensity?
That was a misleading statement.
Comment eats just as much resources.
It takes 1-3 milliseconds to generate and display a canvas with text on the whole window.
In MT5, the output of comment takes slightly longer. If you are going to update text information 30 times per second, you still won't see the brakes.

Reason: