Questions from Beginners MQL5 MT5 MetaTrader 5 - page 948

 

Please advise how the following design would look roughly:

1) A new tick is generated - condition is fulfilled, for example, on this tick a pattern indication will be drawn and an alert will be generated

2) After the condition above is fulfilled, it is necessary to stop performing multiple repetitions of the same action of the above action until the time period is equal:

TimeCurrent() <= (time[index] + PeriodSeconds(PERIOD_CURRENT))

3) As soon as the bar changes to the next bar, resume the condition again until the next time period described above

Is such a design realistic?

 
clickaider:

Please advise how the following design would look roughly:

1) A new tick is generated - the condition is fulfilled, for example, on this tick a pattern indication will be drawn and an alert will be given

2) After the condition above is fulfilled, it is necessary to stop multiple repetitions of the same action described above until the time period is equal:

3) As soon as the bar changes to the next bar, resume the condition again until the next time period described above

Is such a design realistic?

You've already written most of the logic yourself...

 
Artyom Trishkin:

You've already written most of the logic yourself...

The logic may be correct, but finding the right functionality is the problem. Could you please advise which functions or example constructs to apply to try to solve the problem, as I'm pretty much stumped here.

 
clickaider:

The logic may be correct, but finding the right functionality is the problem. Could you please advise which functions or example designs to use to try and solve the problem, as I'm pretty much stumped here.

  1. A new tick is generated - condition fulfilled, for example, pattern indication will be drawn on this tick and an alert will be generated.
    1. I need a function to get a condition and set the flag of that condition to work with the next two clauses
    2. Need a function to draw a pattern
    3. I need a function to send alert (not necessarily a function - there are standard functions for only alert, only e-mail and only push)
  2. After the condition above is fulfilled, we need to stop the execution of multiple repetitions of the same action of the above action until a period of time equal to...
    1. If there is a flag that three of above steps from point 1 already done, then do nothing - go to point 3, otherwise go to point 1
  3. As soon as the bar changes to the next one, restart the condition until the next time period described above
    1. We need a function for defining a new bar. As soon as a new bar has been defined, go to point 1. Otherwise, go to point 2.
 

Please help.

I have a list of enum.

enum ENUM_Target_NAME 
  {
   arr_Buy,
   arr_Sell,
   arr_Svod,
   arr_Regr,
   arr_200,
   arr_100,
   Target_25_iD,
   Target_50_iD,
  };
input ENUM_Target_NAME Target=ENUM_Target_NAME(5);

I need the values to become a string, i.e. become a text, this approach does not work

(string)Target

I receive simply the number of a variable value from the list, and I need the text - the real name from the list, for example, "arr_100".

How to do it?

 
Aleksey Vyazmikin:

Please help.

I have a list of enum.

I need the values to become a string, i.e. become a text, this approach does not work

I receive simply the number of a variable value from the list, and I need the text - the real name from the list, for example, "arr_100".

How to do it?

EnumToString()

 
Artyom Trishkin:

EnumToString()

Thank you!

 
Nauris Zukas:

Can you give me a link to the documentation of what these <> symbols mean?

This is a template method. The type of the parameter in it will be matched according to the type passed in these brackets. The type is determined statically at the stage of compiling the program. You can read more about it in "function and class templates":https://www.mql5.com/ru/docs/basis/oop/templates.

Документация по MQL5: Основы языка / Объектно-ориентированное программирование / Шаблоны функций
Документация по MQL5: Основы языка / Объектно-ориентированное программирование / Шаблоны функций
  • www.mql5.com
Перегруженные функции обычно используются для выполнения похожих операций над различными типами данных. Простой пример такой функции в MQL5 - ArraySize(), которая возвращает размер массива любого типа. На самом деле эта системная функция является перегруженной, и вся реализация такой перегрузки спрятана от разработчика программ на MQL5: То есть...
 
Nauris Zukas:

Good afternoon! I have made .mqh for data processing and storage in the resource. Everything works, but there is a nuance, if I compile the indicator, the .mqh is reset and re-does the weight process for storage. Target - as long as there is data in the resource it is not reset. Where is the error, how to fix it?

Resources are designed to hold static (permanent) unchangeable data. Your task is to download a file with data and change the data in the indicator memory and save the new data in the file, so after the restart and recompilation of the indicator you will download new data. Resources will not help to do this.

 
Vasiliy Sokolov:

Resources are designed to hold static (constant) unchangeable data. For your task you need to load a file with data, change this data in the indicator memory and save the new data weight in the file, so that after reloading and recompiling the indicator you can load new data. Resources will not help to do this.

I see, thank you!