Questions from Beginners MQL5 MT5 MetaTrader 5 - page 330

 
ramis866:
Can someone tell me how to use EAs?
See Help: setting up and running EAs.
 
Guys! When the timeframe is changed, the EA is restarted. As a result, it returns all its drawn graphics to the default view. How can I prevent it from restarting when I change the timeframe?
 
net:
Guys! When we change the timeframe, the EA is restarted. As a result, it returns all of its drawn chart to its default appearance. How can I disable the restart when I change the timeframe?

Would it be better to correct a nuance in the Expert Advisor, so that the chart drawn by it is displayed correctly after the change of the TF?

 
net:
Guys! When you change timeframe, the Expert Advisor is restarted. As a result, it returns all its drawn chart to the default view. How can I disable the restart when I change the timeframe?

You can't prohibit it. And is it necessary to save the chart? After all, for each timeframe of the chart, all of the constructions can vary dramatically.Take the MACD indicator on different timeframes of the chart as an example.And if the chart plotting is necessary, you need to change the logic of the Expert Advisor.

The Expert Advisor and the indicator must be restarted after the change of the chart period - this is the logic of the function OnInit() - handler of the Init event:

Init

Immediately after the client terminal loads a program (Expert Advisor or custom indicator) and starts the initialization of global variables, an Init event will be sent, which is handled by the OnInit() function, if it has one. This event is also generated after a security and/or chart period change, after recompiling the program in MetaEditor, after a change of input parameters from an Expert Advisor or a custom indicator setting window. The Expert Advisor is also initialized after the account is changed. The Init event is not generated for scripts.

 
barabashkakvn:

You can't prohibit it. And is it necessary to save the chart? After all, for each timeframe of the chart, all of the constructions can vary dramatically.Take the MACD indicator on different timeframes of the chart as an example.And if the chart plotting is necessary, you need to change the logic of the Expert Advisor.

The Expert Advisor and the indicator must be restarted after the change of the chart period - this is the logic of the function OnInit () - handler of the Init event:

I do not quite agree. Of course, it is necessary to restart, but it's necessary for resource saving, especially for multitemporal indicators/advisors with a large number of graphical objects - you can bypass some parts of the initialization, in particular, the recalculation of already built. I.e. if by logic (which I personally think is correct) after deinitialization the graphical constructions are deleted, then the reason of TF change should be processed (without deleting constructions). If you want, it is better to adjust object visibility by TF without rebuilding the objects themselves.
 
Tapochun:
I don't quite agree. Of course, it is necessary to restart, but for the sake of resource saving, just for multitemporal indicators/advisors with a large number of graphical objects - you can bypass some parts of initialization, in particular, recalculation of already built. I.e. if by logic (which I personally think is correct) after deinitialization the graphical constructions are deleted, then the reason of TF change should be processed (without deleting constructions). If you want, it is better to adjust visibility of objects by TF without rebuilding of objects themselves.
Everything is in the hands of the programmer.
 

Can you tell me how to find the minimum value of variable with type double from iCustom buffers, there are 8 of them.

I think it is solved by the array, but how to write it I do not know.

Help plz!

 

Hello to all, both freeloaders and professionals, I have no time to re-read all the memoirs of the forum, quietly by the principle of parkour we learn MQ.............

Vobsobschestvya current problem: I downloaded the panel from the example, adapted it in my EA, now the task is to enable and disable this panel in the settings

so in the code

I write in variables :

input bool vkl =false;//delete panel

I explain further

if //

//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//--- Вывести в журнал причину деинициализации
   Print(GetDeinitReasonText(reason));
//--- При удалении с графика
   if(reason==REASON_REMOVE)
      //--- Удалить все объекты с графика, которые относятся к информационной панели   
      DeleteInfoPanel();
      
     
  }

DeleteInfoPanel();

if (vkl=false);

----------------

then an error or something else he doesn't understand me))

If you know how to do it correctly by example, or show me where to find a file with an example

 
alhoya:

Can you tell me how to find the minimum value of variable with type double from iCustom buffers, there are 8 of them.

I think it is solved by the array, but how to write it I do not know.

Help plz!

After you get a handle of the custom indicator using iCustom, you copy the value from the analyzed buffer of the custom indicator to your buffer using CopyBuffer in OnCalculate(). It remains to find the minimum value in your buffer using ArrayMinimum.
 
aleks557:

...

In order to delete something, it has to be created first.

void DeleteInfoPanel()
  {
   DeleteObjectByName("InfoPanelBackground");   // Удалить фон панели
   DeleteObjectByName("InfoPanelHeader");       // Удалить заголовок панели
//--- Удалить свойства позиции и их значения

And one more thing: when you change EA properties (in input parameters you have set condition true - you want to delete the EA), this condition will not let you delete the panel:

void OnDeinit(const int reason)
  {
//--- Вывести в журнал причину деинициализации
   Print(GetDeinitReasonText(reason));
//--- При удалении с графика
   if(reason==REASON_REMOVE)
      //--- Удалить все объекты с графика, которые относятся к информационной панели   
      DeleteInfoPanel();

  }

This condition will only work if you delete the Expert Advisor from the chart.