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

 

Can you keep it simple?)))

Where do I get this?

The indicator has a closed code, how do I know the name of this enumeration?

And what type of variable do I need?

I just know how to merge indicators through iCustom, but I'm not able to go further.)

If it's not too difficult, could you make it simpler))))

ENUM_BASE_CORNER tried, it still won't show.
 
Сергей:

Can you keep it simple?)))

Where do I get this?

The indicator has a closed code, how do I know the name of this enumeration?

And what type of variable do I need?

I just know how to merge indicators through iCustom, but I'm not able to go further.)

If it's not too difficult, could you make it simpler))))

ENUM_BASE_CORNER tried, it still won't show.

Here is an example.

The first option is the use of standard enumeration ENUM_BASE_CORNER.

The second variant is using the custom enum

Then in iCustom, where it should be placed base or my_base variable, depending on which variant you choose.

Files:
100.mq4  5 kb
 
Сергей:

Hello.

Could you give me a hint, I'm in over my head.

I prescribe indicator through iCustom and faced with a problem - indicator has a text menu with a choice, it opens and there are several items prescribed, well, I think it's clear)

How can I add it in menu?

extern int HIT = 0; does not work, stops displaying, leaving no parameter displayed.

Perhaps through ENUM , there what to choose, or maybe something else?

Thanks in advance.

Have you entered all the parameters in iCustom(,,,,,,,) in the correct sequence?

 

Good day everyone. I am trying to collect data when opening orders. I want to record the value of the adh indicator on candlesticks 1,2,3 in a file when opening an order.

I do the following. I opened the data directory, went to the tester folder, went to the files folder and created a file called "ZNA4_ADX.csv" there. then in the library file with the extension .mqh file with the extension . Below is the commented out function code.

void writing_adx_screen1_to_file(int i_param) // ФУНКЦИЯ ЗАПИСИ ДАННЫХ В ФАЙЛ
   { //---НАЧАЛО ФУНКЦИИ ЗАПИСИ В ФАЙЛ ЗНАЧЕНИЯ АДХ ПО ПЕРВОМУ ЭКРАНУЭКРАНУ-----------------------------------------------------------------------+
   
   //-НАЧАЛО ПОЛУЧЕНИЯ ХЕНДЕЛА ОТКРЫВАЕМОГО ФАЙЛА------------------------------------------------------------------------------+
   int hendel= FileOpen("ZNA4_ADX.csv",FILE_WRITE,';');
   
   //-КОНЕЦ ПОЛУЧЕНИЯ ХЕНДЕЛА ОТКРЫВАЕМОГО ФАЙЛА------------------------------------------------------------------------------+
   
   
//---НАЧАЛО ПОЛУЧЕНИЯ ЗНАЧЕНИЯ ОСНОВНОЙ ЛИНИИ АДХ------------------------------------------------------------------------+

  double adx1= iADX(Symbol(),//СИМВОЛ НА КОТОРОМ УСТАНОВЛЕН СОВЕТНИК
  PeriodForWork_screen1,// ТАЙМ ФРЕЙМ ПЕРВОГО ЭКРАНА
  period_adx_zapici_v_fail, //ПЕРИОД АДХ ДЛЯ ЗАПИСИ В ФАЙЛ 
  Price_adx_dl9_zapici,     // ЦЕНА РАСЧЁТА ЛИНИЙ АДХ ДЛЯ ЗАПИСИ В ФАЙЛ
  MODE_MAIN // ПОЛУЧЕНИЕ ЗНАЧЕНИЯ ОСНОВНОЙ ЛИНИИ АДХ 
,1);

//---АДХ_СВЕЧА 2 НАЧАЛО------------------------------------------------------------------------------------------+

double adx2= iADX(Symbol(),//СИМВОЛ НА КОТОРОМ УСТАНОВЛЕН СОВЕТНИК
  PeriodForWork_screen1,// ТАЙМ ФРЕЙМ ПЕРВОГО ЭКРАНА
  period_adx_zapici_v_fail, //ПЕРИОД АДХ ДЛЯ ЗАПИСИ В ФАЙЛ 
  Price_adx_dl9_zapici,     // ЦЕНА РАСЧЁТА ЛИНИЙ АДХ ДЛЯ ЗАПИСИ В ФАЙЛ
  MODE_MAIN // ПОЛУЧЕНИЕ ЗНАЧЕНИЯ ОСНОВНОЙ ЛИНИИ АДХ 
,2);
//---АДХ_СВЕЧА 2 КОНЕЦ---------------------------------------------------------------------------------------------+

//---АДХ_СВЕЧА 3 НАЧАЛО------------------------------------------------------------------------------------------+

double adx3= iADX(Symbol(),//СИМВОЛ НА КОТОРОМ УСТАНОВЛЕН СОВЕТНИК
  PeriodForWork_screen1,// ТАЙМ ФРЕЙМ ПЕРВОГО ЭКРАНА
  period_adx_zapici_v_fail, //ПЕРИОД АДХ ДЛЯ ЗАПИСИ В ФАЙЛ 
  Price_adx_dl9_zapici,     // ЦЕНА РАСЧЁТА ЛИНИЙ АДХ ДЛЯ ЗАПИСИ В ФАЙЛ
  MODE_MAIN // ПОЛУЧЕНИЕ ЗНАЧЕНИЯ ОСНОВНОЙ ЛИНИИ АДХ 
,3);
//---АДХ_СВЕЧА 3 КОНЕЦ----------------------------------------------------------------------------------------+

//--КОНЕЦ ПОЛУЧЕНИЯ ЗНАЧЕНИЯ ОСНОВНОЙ ЛИНИИ//------------------------------------------------------------------------------+
if(hendel>0)
FileWrite(hendel,"ордер "+(string)i_param+" "+(string)adx1,(string)adx2,(string)adx3); // ЗАПИСЫВАЮ ДАННЫЕ В ФАЙЛ:)

FileClose(hendel);

   
   }//---КОНЕЦ ФУНКЦИИ ЗАПИСИ В ФАЙЛ ЗНАЧЕНИЯ АДХ ПО ПЕРВОМУ ЭКРАНУ----------------------------------------------------------------+

I want the data was written like on the screenshot below.

EXAMPLE OF HOW I WANT TO RECORD DATA


That is, the red text is a header that I will write manually. Line 2 is what I want to set with this function. That is, 1 is the order number in the test. And we have three adx values. Then when the second order opens in the test, we need the next line where the order number becomes 2, and adx values will be written for three candlesticks before this order opens, and so on as many orders in the test will come out...

I am calling the function itself in the EA code as shown in the code snippet below.


  //---КОНЕЦ БАЙ ТРЕНДА СИГНАЛ АО------------------------------------------------------------------------------------------+
  if(f_end_trend_buy_ao_market_order() && count_orders_market_buy == 0 && count_orders_market_sell == 0)
  {// НАЧАЛО ЕСЛИ ЕСТЬ СИГНАЛ ОКОНЧАНИЯ БАЙ ТРЕНДА ДИВЕРЕГЕНЦИЯ АО
      if(OrderSend(Symbol(),OP_SELL,lot,Bid,slippages,Bid+sl , Bid-tp ,Coment, Magik_number)) Print("ОТКРЫВАЕМ ОРДЕР СЕЛЛ ПО СИГНАЛУ ОКОНЧАНИЯ ТРНЕДА- ДИВЕРЕГЕНЦИЯ АО"); // ОТКРКЫВВАЕМ СЕЛ ОРДЕР
      writing_adx_screen1_to_file(i_nomer_ordera);// ВЫЗОВ ФУНКЦИ ЗАПИСИ ДАННЫХ В ФАЙЛ
      if (GetLastError()==141){Alert("ОШИБКА № "+string(GetLastError())+"УДАЛЯЕМ ЭКСПЕРТА С ГРАФИКА"); ExpertRemove();}// ПРОВЕРКА ОТ ДОЛБАНИЯ СЕРВЕРА И БАНА СЧЁТА   


  } // КОНЕЦ ЕСЛИ ЕСТЬ СИГНАЛ ОКОНЧАНИЯ БАЙ ТРЕНДА ДИВЕРЕГЕНЦИЯ АО//-------------------------------------------------------------------------------------------------+
  



The test is running without any errors, but I got this result in the file (SCREEN BELOW ).

WHAT I GOT WHEN WRITING TO THE FILE


I got one line with the first order and three values, but there were 189 open orders in the test. What and where did I forget to increase the variable for counting the number of orders and how should I make the data following the first order be recorded in lines 2,3-189? Please don't send me to code base and other places where it is difficult for me to read text, and other people's code is almost impossible. So tell me in a clear way what to add and where I can get the data I need? P/S if you don't mind highlighting the point with the addition ...

 
DanilaMactep:

Good day everyone. I am trying to collect data when opening orders. I want to write the value of the adh indicator on candlesticks 1,2,3 into a file when opening an order.

I do the following. I opened the data directory, went to the tester folder, went to the files folder and created a file called "ZNA4_ADX.csv" there. then in the library file with the extension .mqh file with the extension . Below is the commented out function code.

I want the data was written like on the screenshot below.


That is, the red text is a header that I will write manually. Line 2 is what I want to set with this function. That is, 1 is the order number in the test. And we have three adx values. Then when the second order opens in the test, we need the next line where the order number becomes 2, and adx values will be written for three candlesticks before this order opens, and so on as many orders in the test will come out...

I am calling the function itself in the EA code as shown in the code snippet below.




The test is running without any errors, but I got this result in the file (SCREEN BELOW ).


I got one line with the first order and three values, but there were 189 open orders in the test. What and where did I forget to increase the variable for counting the number of orders and how should I make the data following the first order be recorded in lines 2,3-189? Please don't send me to code base and other places where it is difficult for me to read text, and other people's code is almost impossible. So tell me in a clear way what to add and where I can get the data I need? P/S if you don't mind highlighting the point with the addition ...

If file is opened with only one flag FILE_WRITE, everything in file is removed. To save existing data in file, you need to open file for reading and writing.

Then do not forget to move the pointer to the end of the file.

 
Alexey Viktorov:

If a file is opened with only one flag FILE_WRITE, everything in the file is deleted. To save existing data in the file, you must open the file for reading and writing.

Then do not forget to move the pointer to the end of the file.

Alexey, thank you very much for pointing out where to "dig" the error - so far I've managed to make a line-by-line record - all that's left is to comb the whole thing into a usable form for analysis))))
 

The values of the array are in RAM cells which follow each other. The maximum length of unoccupied cells may depend on.

 
Why doesn't this work with function addresses?
template<typename T>
typedef T (*Fun)(const int, const int, const double &[], const double &[], const double &[], const double &[], const int &[]);
Fun    calculation,
       function;

//------------------------------------------------------------------------------------------------------------------------------

int OnInit()
  {
   calculation  = test;
   function     = Dis_HL_Value;
  //-----------------------------------------------------------------
   return(INIT_SUCCEEDED);
  }
 
Hello, can you tell me if this is a declaration of a two-dimensional array?
      ArrayInitialize(ZigZagBuffer,0.0);
Thanks in advance!
 
Дмитрий:
Hello, can you tell me if this is a declaration of a two dimensional array? Thanks in advance!

No, it's an initialisation of an already declared one.

Reason: