Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 958

 
Artyom Trishkin:
  1. You wanted to get away from resizing when scaling ...
  2. OnChartEvent() is not tick-dependent
  3. All objects created in OnChartEvent() should be updated when the necessary chart event is registered. Otherwise, only on a new tick will be updated.

Got it. Thank you!

 
Igor Kryuchkov:

Got it. Thank you!

The code I showed you is not optimal. It's just an example. Method Update(true) works in loop there - it's unreasonable to redraw the chart when drawing each new object in loop. Need to update all of the created objects after the loop - they are all stacked in list_canvas - after the passage of the main loop to go through all of the objects in list_canvas, and already from there for each of them to call the method update. For all of them, Update(false) should be called, and for the most recent one, Update(true).

 
Igor Kryuchkov:

Got it. Thank you!

https://www.mql5.com/ru/docs/standardlibrary/canvasgraphics/ccanvas/ccanvastextout


How do I change the font size in Canvas TextOut?

Документация по MQL5: Стандартная библиотека / Пользовательская графика / CCanvas / TextOut
Документация по MQL5: Стандартная библиотека / Пользовательская графика / CCanvas / TextOut
  • www.mql5.com
Стандартная библиотека / Пользовательская графика / CCanvas / TextOut - справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
Igor Kryuchkov:

https://www.mql5.com/ru/docs/standardlibrary/canvasgraphics/ccanvas/ccanvastextout


How do I change the font size in Canvas TextOut?

Completely redraw it.

A canvas is a canvas, and the text in it is the brushwork painted on the canvas. To change the painting, you have to paint over the entire canvas with the background and redraw it again.

Or you can create a text on your own canvas and overlay it on top of the main canvas. Then you don't have to erase and re-paint the whole painting, just the canvas with the text.

 
Artyom Trishkin:

Completely repaint it.

The canvas is the canvas and the text in it is the brushwork painted on the canvas. To change the painting, you have to paint over the background of the whole canvas and redraw it.

Or you could create text on your canvass and overlay it on top of the main canvas. Then you wouldn't have to erase and redraw the entire painting, but only the canvas with the text.

Got it. But I don't see a function for changing the font size of the text or font size options when creating text.

 
Igor Kryuchkov:

Got it. But I don't see a function for changing the text font size or font size options when creating text.

There's a reason I gave you links to the documentation - there's a list of all the methods. Just read it.

Документация по MQL5: Стандартная библиотека / Пользовательская графика / CCanvas / FontSizeSet
Документация по MQL5: Стандартная библиотека / Пользовательская графика / CCanvas / FontSizeSet
  • www.mql5.com
Стандартная библиотека / Пользовательская графика / CCanvas / FontSizeSet - справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
What period of testing is considered acceptable? Is ten years enough?
 
Artyom Trishkin:

There's a reason I'm giving you links to documentation - there's a list of all the methods. Just read it.

You can only specify the font size there. That's why I'm asking, where are the other parameters? How does the system know which text to change. Hmm. Maybe I don't quite understand how Canvas works...

 
Yevhenii Levchenko:
What period of testing is considered acceptable? Is ten years enough?

At least since 2013.

 
Professionals, advise what to do? I start MT4 only several times a day, in the window with charts I look at signals of my Expert Advisor. I have a problem with the fact that my Expert Advisor starts working immediately with the first tick and the history from the previous visit is loaded. How to make make data load first, and then the Expert Advisor works. I have some problems with it. I have a simple profile with charts first, and then a chart with Expert Advisor...
Reason: