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

 
Aleksandr Egorov:

That's what I wanted to ask, because it's a base one.

I searched the forum - this is the only thing that can replacehttps://www.mql5.com/ru/forum/157690#comment_3807848

Alexey Viktorov  2015.12.07 18:35        RU
Сделай шаблон с именем советника, чтобы на графике был индикатор с нужными настройками и будет тебе счастье.
как отобразить индикатор вызванный из эксперта?
как отобразить индикатор вызванный из эксперта?
  • 2015.12.07
  • www.mql5.com
Здравствуйте, написал пользовательский индикатор для МТ4. При вызове его из эксперта он не отображается на графике...
 
SanAlex:

I searched the forum - this is the only thing that can replacehttps://www.mql5.com/ru/forum/157690#comment_3807848

Are you sure this is what he needs for the tester?

 
Alexey Viktorov:

Are you sure he needs it for the tester?

Why for the tester? asked ---- from the expert to install the indicator

\\\\\\\\\\\\\\\\\\

Aleksandr Egorov 2021.04.15 17:28 #14457       RU
как вызвать индикатор из советника что бы при набрасывании советника на график в нижней части графика появлялся индикатор 
 
I have made a panel in a separate indicator window, when you draw an EA and then have to draw the indicator to display everything I would like the indicator to be called when drawing the EA from the EA panel
 
SanAlex:

Why for a tester? asked ---- from the expert to install the indicator

\\\\\\\\\\\\\\\\\\

But the link you gave is to an EA for the tester. When you start an EA in the tester with visualisation, a template with the name of the EA is loaded, if there is no such template, it is loaded with the name "tester.tpl" and if there is no such template either, the default template is loaded.

 
Aleksandr Egorov:
I made a panel in a separate indicator window. When you create an EA, you have to create an indicator, so that everything would be displayed I would like the indicator to be called when creating an EA from the EA

It's not easier, save the template

 
Alexey Viktorov:

But the link you gave is to a tip for the tester. When you start an EA in the visualisation tester, it loads a template with the name of the EA, if there isn't one, it loads one with the name "tester.tpl" and if there isn't one either, it loads the default template.

What difference does it make - there is no output but the template

\\\\\\\\\\\\\\\\\\\\\\

here is the question and answer

ChartIndicatorAdd 2

 
SanAlex:

Isn't it easier to save the template

and call the template from the EA?

 
Aleksandr Egorov:

and call the template from the EA?

You can also call the advisor - but why?

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

here is a function

//+------------------------------------------------------------------+
//|                                           ChartApplyTemplate.mq4 |
//|                        Copyright 2021, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2021, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
#property script_show_inputs
input string   Template                     = "ADX";             // Имя шаблона(without '.tpl')

ENUM_TIMEFRAMES TimeFrame;                   // Change TimeFrame - Current = dont changed
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
   long currChart,prevChart=ChartFirst();
   int i=0,limit=100;
   bool errTemplate;
   while(i<limit)
     {
      currChart=ChartNext(prevChart);
      if(TimeFrame!=PERIOD_CURRENT)
        {
         ChartSetSymbolPeriod(prevChart,ChartSymbol(prevChart),TimeFrame);
        }
      errTemplate=ChartApplyTemplate(prevChart,Template+".tpl");
      if(!errTemplate)
        {
         Print("Error ",ChartSymbol(prevChart),"-> ",GetLastError());
        }
      if(currChart<0)
         break;
      Print(i,ChartSymbol(currChart)," ID =",currChart);
      prevChart=currChart;
      i++;
     }
  }
//+------------------------------------------------------------------+
 
SanAlex:

What difference does it make - there's no way out but the pattern.

Well, thank you... At least I saw myself six years ago... I was just like you are now. I didn't think twice about giving advice in the wrong way.

As for the template: If the template has an indicator, but no EA, then the template will be loaded without the EA... And if the template has an EA? Are you sure that the EA loaded by the template will not apply the template and thus will loop and hang the terminal?

Reason: