Questions from Beginners MQL4 MT4 MetaTrader 4 - page 211

 

Hi Experts!

Can you please advise me, is it possible to put MT4 on VPS server with Linux operating system? Will EAs work normally on such MT?

 

Hello.

Doing EAs for control and risk management. What is the best way to prohibit all running EAs to trade? For example, by a specific symbol, we prohibit all running EAs to enter new trades. Unfortunately, there is no source code of all running EAs and there is no way to use global variables.

 

odyn:

with a Linux operating system?

Mikhail works on Linux. Email him at https://www.mql5.com/ru/users/nikelodeon

Mihail Marchukajtes
Mihail Marchukajtes
  • www.mql5.com
Добавил тему Целевая функция в тестере Коллеги решил выделить вопрос в отдельную тему. При оптимизации параметров советника существует ряд стандартных функций, а так же "Максимум пользовательского критерия" что позволяет производить подбор относительно собственной целевой, пусть даже Если Вы являетесь владельцем инвестиционного фонда и...
 

Good evening!

Please help with the following question:

You need to know how many candles closed abovethe moving average, and how many below.

For example: If 20 candlesticks closed above the moving average with a period of 20, then do something else, if below.

Thank you!

Moving Average of Oscillator (OsMA)
Moving Average of Oscillator (OsMA)
  • www.mql5.com
On Balance Volume (OBV) Индикатор Балансового Объема (On Balance Volume, OBV) связывает объем и изменение цены, сопровождавшее данный объем. Momentum Индикатор движущей силы рынка (Momentum) измеряет величину изменения цены финансового инструмента за определенный...
 
leonerd:
What is the best way to ban all running EAs from trading?

If you can't change the EA code, then disable auto-trading. Here is the code, not mine:

#include <WinUser32.mqh>

#import "user32.dll"
// Считывает описатель оpгана упpавления, содеpжащийся в указанном блоке диалога. Возвpащаемое значение: идентификатоp оpгана упpавления; 0 - если указанный оpган упpавления не существует.
int      GetDlgItem(int hDlg,        // Блок диалога, содеpжащий оpган упpавления.
                     int nIDDlgItem); // Идентификатоp оpгана упpавления.
// Возвращает идентификатор hierarchyid, представляющий n-го предка данного элемента.
int      GetAncestor(int hWnd,      // Идентификатоp окна.
                      int gaFlags);  // Уровень окна от текущего окна (1, 2, 3...).
int      SendMessageA(int  hWnd,      // Окно, пpинимающее сообщение или $FFFF для посылки всем всплывающим окнам в системе.
                       int  Msg,       // Тип сообщения.
                       int  wParam,    // Дополнительная инфоpмация о сообщении.
                       int& lParam[]); // Дополнительная инфоpмация о сообщении.
                  
#import

void start() {
   if (IsExpertEnabled()) ExpertEnabled (false);
      else ExpertEnabled (true);
}

// Функция включения/отключения эксперта.
void ExpertEnabled (bool Switch) // TRUE - включить эксперт, FALSE - отключить эксперт.
{
  int HandlWindow = WindowHandle (Symbol(), Period()); // Системный дескриптор окна.
  int HandlMT4;        // Системный дескриптор окна МТ4.
  int HandlToolbar;    // Системный дескриптор окна инструментов.

  int    ArIntTemp[1]; // Временный массив.
  //----
  if ((Switch && !IsExpertEnabled()) || (!Switch && IsExpertEnabled()) )  {
     HandlMT4 = GetAncestor (HandlWindow, 2); 
     HandlToolbar = GetDlgItem (HandlMT4, 0x63);
     ArIntTemp[0] = HandlToolbar;
     SendMessageA (HandlMT4, WM_COMMAND, 33020, ArIntTemp);
  }
}
 
Xopb:

You need to find out how many candles closed abovethe moving average and how many below.

1. Decide for yourself from which point you want to count.

2. Create an array with two elements.

3. Add a one at each candle to the right element.

4. Decide when you want to stop counting.


A moving average is a lagging tail of price. Profit does not live there.

 
Aleksei Stepanenko:

1. Decide for yourself from when you want to count.

2. Create an array with two elements.

3. Add a one at each candle to the right element.

4. Decide when you want to stop counting.


A moving average is a lagging tail of price. Profit does not live there.

Aleksei, thank you!

Could you please tell me where to add arrays and one to make it work?

for(int i=1;i<=10;i++)            //допустим надо проверить 10 свечей выше или ниже МА в момент когда обратились к этому оператору
     {    
     double hig10 = iMA (NULL,PERIOD_H1,10, 0, MODE_SMA, PRICE_CLOSE, i);
      if (hig10>iClose(Symbol(),PERIOD_H1,i))
      {
    // тут выполняем - если все 10 свечей выше МА     
      }
      else
      {
     //тут выполняем - если если хотябы одна из свечей закрылась нижн MA
      }
      
     } 
     




 

It is even better to make a structure

struct Count
   {
   int up;
   int dn;
   } count;

don't forget to zero out the elements before you start using them

count.up=0;
count.dn=0;

and then increase the count where needed

count.up++;

//или
count.dn++;

then compare

if(count.up>10)
   {

   }
You have now made a loop around the previous 10 candles on each new cand le. This is not rational. You should always get rid of unnecessary cycles by remembering the results of the calculations of the previous values. In your case, when a new candle arrives, just increase the count when the condition is fulfilled, and if the condition is not fulfilled, then subtract it. And check if there is no excess. Your cycle for 10 elements is not needed, only the main one.
 
Aleksei Stepanenko:

If you can't change the EA code, then disable auto-trading. Here's the code, not mine:

Thank you. Will this code disable auto-trading for the specific EA attached to the specified chart? Or general autotrading in the terminal?

 

All trade, this button:


Reason: