Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1175

 
Peter Vorobyev:

Change MQ's source code and pull methods into public ones, it is clear that this is not our method :)

#define private public

if you don't want it that way, then all elements inCAppDialog are formed by graphical objects, you only need to know the object name, and after creating an instance of CAppDialog class, write a method that will repaint CAppDialog borders in the colour you want

 
Igor Makanu:

if you don't want it that way, all CAppDialog panel elements are formed as graphical objects, you only need to know the name of the object and after creating an instance of CAppDialog class, write a method that will paint the CAppDialog borders in the colour you want

via this. you can transfer the code looking for the correct control within the class. This works.

But I don't know how to access it, knowing the name of the object.

 
Peter Vorobyev:

You can use this to move the code to find the control you need within the class. This works.

But I don't know how to access it knowing the name of the object.

https://www.mql5.com/ru/docs/objects/objectsetinteger

but I think it's easier to redefine all the private methods and fields to public for your own needs

 
Igor Makanu:

https://www.mql5.com/ru/docs/objects/objectsetinteger

but I think it's easier to redefine all closed methods and fields to public for your own needs

ObjectSetInteger - works :), I forgot all about it.
Can you give an example for#defineprivate public - I don't understand how to override method. Is it necessary to do this in your class?

 
Peter Vorobyev:

ObjectSetInteger - works :), I forgot all about it.
Can you give an example for#define private public - I don't understand how to override method. Is it necessary to do this in your class?

#define private public
#include <Controls\Dialog.mqh>
// тут весь Ваш класс который наследуете от CAppDialog
#undef private
Experiment with undef, after macro substitution you can cancel it and close all public methodsof CAppDialog in your class to make it easier to write code later
 
Igor Makanu:

Igor, yes it works. Thank you.

 

Running genetic optimisation of an EA on MT5 with local agents connected to the home network.

The Expert Advisor takes some initial data from a text file.

I open the file with flags: FILE_READ|FILE_SHARE_READ|FILE_ANSI|FILE_CSV|FILE_COMMON

In order for the local agents to find the file, I had to copy it to the Common folder of the local computer terminal.

Is the only way out is to manually duplicate the required files to all local machines every time?

Can't the terminal itself send this file along with the input test parameters?

 
How do I find out the price of the Fibonacci fan level on the current bar programmatically?
 
Сергей Таболин:
How do I find out the price of the Fibonacci fan level on the current bar programmatically?
bool  ObjectGetDouble(
   long                            chart_id,          // идентификатор графика
   string                          name,              // имя объекта
   ENUM_OBJECT_PROPERTY_DOUBLE     OBJPROP_LEVELVALUE,           // идентификатор свойства
   int                             prop_modifier,     // модификатор свойства
   double&                         double_var         // сюда примем значение свойства
   );
Документация по MQL5: Графические объекты / ObjectGetDouble
Документация по MQL5: Графические объекты / ObjectGetDouble
  • www.mql5.com
2. Возвращает true или false в зависимости от успешности выполнения функции.  В случае успеха значение свойства помещается в приемную переменную, передаваемую по ссылке последним параметром. [in]  Модификатор указанного свойства. Для первого варианта по умолчанию значение модификатора равно 0. Большинство свойств не требуют модификатора...
 
Alexey Viktorov:
void OnTick()
{
//---
   Print(TimeToString(TimeLocal()));
   Print(ObjectGetDouble(0,"TrL",OBJPROP_PRICE));
}

Gives out the price of the first point of the trend line. (((

2020.01.18 11:46:37.233 2019.11.29 00:00:00   2019.11.29 00:00
2020.01.18 11:46:37.233 2019.11.29 00:00:00   1.00245
2020.01.18 11:46:39.533 2019.11.29 08:00:00   2019.11.29 08:00
2020.01.18 11:46:39.533 2019.11.29 08:00:00   1.00245
2020.01.18 11:46:41.834 2019.11.29 16:00:00   2019.11.29 16:00
2020.01.18 11:46:41.834 2019.11.29 16:00:00   1.00245
2020.01.18 11:46:44.135 2019.12.02 00:00:00   2019.12.02 00:00
2020.01.18 11:46:44.135 2019.12.02 00:00:00   1.00245
Reason: