Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1316

 

Through WinAPI you can, if it suits you.

there is a function in kernel32.dll

BOOL GetFileTime(
  HANDLE     hFile,
  LPFILETIME lpCreationTime,
  LPFILETIME lpLastAccessTime,
  LPFILETIME lpLastWriteTime
);

https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfiletime

GetFileTime function (fileapi.h) - Win32 apps
GetFileTime function (fileapi.h) - Win32 apps
  • 2018.12.05
  • mikben
  • docs.microsoft.com
Retrieves the date and time that a file or directory was created, last accessed, and last modified.
 

There's something here

https://www.mql5.com/ru/articles/1540

Файловые операции через WinAPI
Файловые операции через WinAPI
  • www.mql5.com
Исполнительная среда MQL4 основана на концепции безопасной "песочницы": чтение и запись средствами языка разрешены только в определенных папках. Это защищает пользователя MetaTrader 4 от потенциальной опасности испортить важные данные на жестком диске компьютера. Но иногда все же бывает необходимость покинуть безопасную зону. Как это сделать легко и правильно - об этом статья.
 
Aleksei Stepanenko:

There's something here

https://www.mql5.com/ru/articles/1540

Thank you!

There's no way to do it with the standard tools.

 
Looks like it, I don't know the local way. GetFileTime needs to pass the handle from the kernel as well.
 
Artyom Trishkin:
What's not good with ChartIndicatorAdd()?
This wonderful function requires indicator_handle

How to get this parameter for technical indicators I have found, namely:
Each technical indicator has its own function, e.g. for MACD:

indicator_handle=iMACD(symbol,period,fast_ema_period,slow_ema_period,signal_period,apr);

My question is about a custom indicator.
I couldn't find in the help how to getindicator_handle of my indicators, especially at the time when they are not yet in the window.

It's possible that I wasn't looking hard enough.
I would be extremely grateful for a link.

 
User_mt5:
This great function requires indicator_handle

How to get this parameter for technical indicators I have found, namely:
Each technical indicator has its own function, e.g. for MACD:

My question is about a custom indicator.
I couldn't find in the help how to getindicator_handle of my indicators, especially at the time when they are not yet in the window.

It's possible that I wasn't looking hard enough.
I would be extremely grateful for a link.

iCustom()
Документация по MQL5: Технические индикаторы / iCustom
Документация по MQL5: Технические индикаторы / iCustom
  • www.mql5.com
iCustom - Технические индикаторы - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
Artyom Trishkin:
iCustom()
Thank you very much! You've really helped me out!

And of course, where else should this function be but in the middle of the list of technical indicators...)
 
serg_V777:
Greetings.
I have a problem with horizontal lines in MQL5.
A manually created horizontal line in the GAZP chart is also displayed in the SBER chart since their prices are similar. Please advise how to save the line and display it where it was created.
***
neither in the first nor in the second variant does not want to work...
Pleaseinsert the codecorrectly: when editing a message, click on Code and paste your code in the popup window.
MQL5.community - Памятка пользователя
MQL5.community - Памятка пользователя
  • www.mql5.com
Вы недавно зарегистрировались и у вас возникли вопросы: Как вставить картинку в сообщение на форуме, как красиво оформить исходный код MQL5, где находятся ваши Личные сообщения? В этой статье мы подготовили для вас несколько практических советов, которые помогут быстрее освоиться на сайте MQL5.community и позволят в полной мере воспользоваться доступными функциональными возможностями.
 

I have a problem withhorizontal lines in MQL5.
A manually created horizontal line in the GAZP chart is also displayed in the SBER chart since their prices are similar. Please advise how to save the line and display it in the place it was created.
does not want to work with the first or the second option...

preff=ChartSymbol( NULL);
price=SymbolInfoDouble(Symbol(),SYMBOL_BIDLOW);
ObjectCreate(0,preff+"hhh",OBJ_HLINE,0,0,price) ;
/////////////////////////////////////////////////////////////
if(preff+"hhh" != ChartSymbol(0) ){
ObjectSetInteger(0,preff+"hhh",OBJPROP_COLOR,clrNONE); }
///////////////////////////////////////////////////////////
if(preff != ChartSymbol(NULL) ) {
ObjectSetInteger(0,preff+"hhh",OBJPROP_COLOR,clrNONE); }



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

I have a problem withhorizontal lines in MQL5.
A manually created horizontal line in the GAZP chart is also displayed in the SBER chart since their prices are similar. Please advise how to save the line and display it in the place it was created.
neither the first nor the second version does not want to work...



See the errors:

1. Always explicitly specify a graph symbol (yes, you can rely on documentation, but it's better to ALWAYS specify explicitly)

   preff=ChartSymbol(Symbol());
   price=SymbolInfoDouble(Symbol(),SYMBOL_BIDLOW);
   ObjectCreate(0,preff+"hhh",OBJ_HLINE,0,0,price) ;
//---
   if(preff+"hhh" != ChartSymbol(Symbol()))
     {
      ObjectSetInteger(0,preff+"hhh",OBJPROP_COLOR,clrNONE);
     }
//---
   if(preff != ChartSymbol(Symbol()))
     {
      ObjectSetInteger(0,preff+"hhh",OBJPROP_COLOR,clrNONE);
     }

2. String makes no sense - as preff+"hhh" will never equal Symbol()


Added: better to have this approach - always one line on the chart, just change the line price when you switch charts.