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

 
Valeriy Yastremskiy:

I don't understand, maybe I'm talking about the wrong window. I mean the chart window where the bars are. These move. There are also dialog windows when loading EA indicators, alert windows, message windows, but they all move. Which window are we talking about? The dialog box has nothing to do with it. I also have no libraries in 4

Here's the owl window.


I want to move it on the chart when I need it.

 
MakarFX:

Here is the owl window


That's what I want to move on the schedule when I need to.

It's not a window, it's a panel. You can move it, I can't even tell you the code. I need the code and redraw it in general. I need to find where the panel is drawn and coordinates are specified - then, using events, I click to move it, delete it and draw a new one. Like this. But I'm not a draftsman at all.

 
Valeriy Yastremskiy:

When deleting in an EA, you don't need to clean the comment, but in an indicator you do. Is it designed that way?

An adequate programmer would at least write

void OnDeinit(const int reason)
{
     Comment( "" );
}
If comments have been used, he will clean them up after himself. And many beginners don't pay attention to this. That's the secret.
 
Hello.
Can you tell me (formula) how to calculate the price for a certain level (taking into account open positions)? To calculate at what price there will be a margin call and stop out.
 
Konstantin Nikitin:

An adequate programmer would at least write

If comments have been used, he will clean them up after himself. And many beginners do not pay attention to this. That's the secret.

That's what I wrote, and I wrote about it above). The question was why the different behaviour in EAs and indicators. Is there a hidden meaning or has historically developed from different writing teams)

 
Konstantin Nikitin:

An adequate programmer will at least write

If comments have been used, he will clean them up after himself. And many beginners do not pay attention to this. That's the whole secret.
Actually, there are no obvious general requirements on this.
 
Andrey Sokolov:
Actually, there are no explicit general requirements on this.

Did I talk about the requirement? I only said that some take this point into account and some do not.

 
Konstantin Nikitin:

Did I talk about the requirement? I only said that some take this point into account and some don't.

Not like that.

 

The libraryEASY AND FAST https://www.mql5.com/ru/articles/3527 implements the possibility to start a program window in an indicator subwindow by loading the file "SubWindow.mq5", in mql5 everything works, in mql4 also the content is compiled without errors, but the subwindow does not open, what can be done?


//+------------------------------------------------------------------+
//|                                                    SubWindow.mq5 |
//|                        Copyright 2016, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "2016, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property indicator_separate_window
#property indicator_plots   0
#property indicator_buffers 0
#property indicator_minimum 0.0
#property indicator_maximum 0.0
//--- Имя программы
#define  PROGRAM_NAME ::MQLInfoString(MQL_PROGRAM_NAME)
//--- Идентификатор события для изменения высоты подокна эксперта
#define  ON_SUBWINDOW_CHANGE_HEIGHT (38)
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit(void)
  {
//--- Короткое имя индикатора
   ::IndicatorSetString(INDICATOR_SHORTNAME,PROGRAM_NAME);
//--- Инициализация прошла успешно
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Деинициализация                                                  |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int    rates_total,
                const int    prev_calculated,
                const int    begin,
                const double &price[])
  {
//--- Если инициализация прошла успешно
   if(prev_calculated<1)
      //--- Отправим сообщение эксперту, чтобы получить от него размер для подокна
      ::EventChartCustom(0,ON_SUBWINDOW_CHANGE_HEIGHT,0,0.0,PROGRAM_NAME);
//---
   return(rates_total);
  }
//+------------------------------------------------------------------+
//| ChartEvent function                                              |
//+------------------------------------------------------------------+
void OnChartEvent(const int    id,
                  const long   &lparam,
                  const double &dparam,
                  const string &sparam)
  {
//--- Обработка события изменения высоты подокна эксперта
   if(id==CHARTEVENT_CUSTOM+ON_SUBWINDOW_CHANGE_HEIGHT)
     {
      //--- Принимать сообщения только от имени эксперта
      if(sparam==PROGRAM_NAME)
         return;
      //--- Изменить высоту подокна
      ::IndicatorSetInteger(INDICATOR_HEIGHT,(int)lparam);
      //--- Обновить график
      ::ChartRedraw();
     }
  }
//+------------------------------------------------------------------+
 

Hi all!

I'm trying to attach an account check to (any) indicator!

bool VerifityToSchet()
  {
   if(AccountNumber() != account)
     {
      Print("На данном счете индикатор работать не будет, вы его приобрели незаконным путем!!!");   
     }else
     {
     Print("На данном счете индикатор авторизован");
     }
   return(false);
  } 

I enabled it in init() and start() of course, but when I restart the terminal, it says the account is invalid!

What am I doing wrong?