Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1014

 
Сергей Таболин:

Thanks, I've seen it. But as I said, it's probably because of the symbolic link to the Indicators folder that the resource isn't being added. It says it's not found.

What is the purpose of symbolic links? If the indicators and the Expert Advisor are compiled with direct links, then this EA will work independently of indicators. Let them not have them on the computer at all.

Secondly, we should first create a resource with a direct link and only then try to create a symbolic one. Fortunately, I do not deal with such links and I cannot check how to do this and whether it is possible at all.

 
Alexey Viktorov:

What is the point of symbolic links? ........

The point is simple - all terminals access one instance of EA/indicator/script/library/template.... and there is no need to clone instances.

In addition, it's all within walking distance, not in the middle of nowhere ))))

This leads to a perplexing question: why does it all work via links but the resource is not found?

 
Сергей Таболин:

The point is simple - all terminals access one instance of EA/indicator/script/library/template.... and there is no need to clone instances.

In addition, it's all within walking distance, not in the middle of nowhere ))))

Which bewilders me: why does it all work via links but the resource isn't found?

I'm not talking a bit about that. There is nothing that prevents to temporarily copy these two indicators to a normal place, compile, delete and run the Expert Advisor without restrictions.

Or, if you want to connect the resource with normal location of the indicator, then try to change it to symbolic link.

 

What does this code look like in mt5?

//+----------------------------------------------------------------------------+
//|  Автор    : Ким Игорь В. aka KimIV,  http://www.kimiv.ru                   |
//+----------------------------------------------------------------------------+
//|  Версия   : 12.08.2008                                                     |
//|  Описание : Возвращает номер недели месяца по дате                         |
//+----------------------------------------------------------------------------+
//|  Параметры:                                                                |
//|    dt - дата, время                                                        |
//+----------------------------------------------------------------------------+
int WeekOfMonth(datetime dt) {
  datetime d;
  int      i, kd=TimeDay(dt), nn=1;

  for (i=2; i<=kd; i++) {
    d=StrToTime(TimeYear(dt)+"."+TimeMonth(dt)+"."+i);
    if (TimeDayOfWeek(d)==1) nn++;
  }
  return(nn);
}
 
ilvic:

What does this code look like in mt5?

//+------------------------------------------------------------------+
//| Возвращает номер недели месяца по дате, при ошибке -1            |
//+------------------------------------------------------------------+
int WeekOfMonth(const datetime time)
  {
   MqlDateTime tm;
   return(TimeToStruct(time,tm) ? tm.day_of_week : WRONG_VALUE);
  }
//+------------------------------------------------------------------+
 
Artyom Trishkin:

Thank you

 

I'll try to ask here, already lost there)

How can I remove a particular indicator from all charts with one move/click? Applying a new template doesn't work. Maybe a script?

 
Vitaly Muzichenko:

I'll try to ask here, already lost there)

How can I remove a particular indicator from all charts with one move/click? Applying a new template doesn't work. Maybe a script?

Theoretically:

1. We start to search all of the charts.

2) Determine the number of indicators on the chart.

3. Search for the one that needs to be removed and if it is present, remove it.

We proceed to the next chart.

But for this it is necessary to know the short name of the indicator. If the short name contains the values of input parameters, it can not be found. It's like "You see a gopher..."

Hence you have to look for a substring in the indicator name.

 
Alexey Viktorov:

Theoretically, it's like this:

1. Start going through all the charts.

2) Determine the number of indicators on the chart.

3. Search for the one that needs to be removed and if it is present, remove it.

We proceed to the next chart.

But for this it is necessary to know the short name of the indicator. If the short name contains the values of input parameters, it can not be found. It's like "You see a gopher...".

Consequently, it is necessary to search for a substring in the indicator name.

That's how I wanted to do ChartIndicatorName(), but the question arose: How to remove it?

 
Vitaly Muzichenko:

That's how I wanted to do ChartIndicatorName(), but the question arose: how do I remove it?

With an axe.
Документация по MQL5: Операции с графиками / ChartIndicatorDelete
Документация по MQL5: Операции с графиками / ChartIndicatorDelete
  • www.mql5.com
//|                                    Demo_ChartIndicatorDelete.mq5 | //|                        Copyright 2011, MetaQuotes Software Corp. | //|                                              https://www.mql5.com | //| Custom indicator initialization function                         |                           ...