Questions from Beginners MQL5 MT5 MetaTrader 5 - page 932

 

I am writing an EA. I am not testing it in a tester, but in real trading.

Is it possible to clear the log file (tab "Experts") when starting an Expert Advisor?

At the moment, the only way to remove this file is to close the terminal. The way of deleting the file with the terminal open would be fine.

 
pivomoe:

Is it possible to clear the log file (tab "Experts") when an Expert starts?

It is possible to do it manually: on the tab, (right mouse button) -> "Clear"

 
Ivan Ivanov:

You can do this manually: on the tab, (right-click) -> "Clear".

Only the text on the Expert tab will disappear. The file will remain in place. I need to delete or clear the file.

 

I want to teach the machine to find an exact flat. Its conditions are as follows: so there is a bar on the chart


Inorder to form a flat, which I want to find it needs to form 3 barsopposite the 1st bar between its height HL (ie only 4 bars that are located in one range) to compare the bars and find levels wrote this condition

        if(
        Bar_Op[qt+2]<=Bar_Hi[qt+3]&&Bar_Cl[qt+2]>=Bar_Lo[qt+3]&& 
        Bar_Op[qt+2]>=Bar_Lo[qt+3]&&Bar_Cl[qt+2]<=Bar_Hi[qt+3]&&
        Bar_Op[qt+1]<=Bar_Hi[qt+3]&&Bar_Cl[qt+1]>=Bar_Lo[qt+3]&&
        Bar_Op[qt+1]>=Bar_Lo[qt+3]&&Bar_Cl[qt+1]<=Bar_Hi[qt+3]&&
        Bar_Op[qt+0]<=Bar_Hi[qt+3]&&Bar_Cl[qt+0]>=Bar_Lo[qt+3]&&
        Bar_Op[qt+0]>=Bar_Lo[qt+3]&&Bar_Cl[qt+0]<=Bar_Hi[qt+3])         
        {

As I understand it, the comparison is going on, but I have a problem with drawing of levels

double Price_Ur = Bar_Cl[qt+2];

I want to build a level that passes through the close price of the 2nd bar.


I have a question how to return the lowest price from the condition or how to find it may be my condition does not return the price but only compares the tops of the candles that passes through the OP and CL? I used the following notation

int iLwCL=iLowest(_Symbol,PERIOD_D1,MODE_CLOSE,3,qt+1); int iLwOP=iLowest(_Symbol,PERIOD_D1,MODE_OPEN,3,qt+1);
double Price_Ur = Bar_Cl[iLwCL]<Bar_Op[iLwOP] ? Bar_Cl[iLwCL]:Bar_Op[iLwOP];

The functioniLowest determines the lowest top relative to the 0th bar, but in my case it does not find the lowest price. How can I return the lowest price from the condition to build a level as in the case ofdouble Price_Ur = Bar_Cl[qt+2];?

 
Can you tell me if there is a way to transfer an array from one EA to another?
GV variables are very inconvenient for this.
 
User_mt5:
Can you tell me if there is a way to transfer an array from one EA to another?
GV variables are very inconvenient for this.

Maybe this will help https://www.mql5.com/ru/code/818. I've never used it myself.

 
User_mt5:
Can you tell me if there is a way to transfer an array from one EA to another?
GV variables are very inconvenient for this.

Forum on trading, automated trading systems and testing trading strategies

Libraries: TradeTransactions

fxsaber, 2018.09.20 16:23

// Пример хранения/обмена данными через Ресурсы внутри Терминала
#include <fxsaber\TradeTransactions\ResourceData.mqh> // https://www.mql5.com/ru/code/22166

void OnStart()
{  
  const RESOURCEDATA<int> ResourceINT("::int"); // Ресурс для обмена int-ами. const - как доказательство, что ничего не пишется в объект класса
  
  int ArrayINT[] = {1, 2, 3};
  int Num = 5;
  
  ResourceINT = ArrayINT;  // Ресурс хранит массив.
  ResourceINT += Num;      // Добавили в ресурс еще значение.
  ResourceINT += ArrayINT; // Добавили массив.
  
  int ArrayINT2[];  
  ResourceINT.Get(ArrayINT2); // Считали данные из ресурса.
  ArrayPrint(ArrayINT2);      // Вывели: 1 2 3 5 1 2 3

  ResourceINT.Free();                // Удалили данные из ресурса
  Print(ResourceINT.Get(ArrayINT2)); // Убедились, что данных нет: 0

  const RESOURCEDATA<MqlTick> ResourceTicks("::Ticks"); // Ресурс для обмена тиками. const - как доказательство, что ничего не пишется в объект класса
  MqlTick Tick;
  
  if (SymbolInfoTick(_Symbol, Tick))
    for (int i = 0; i < 3; i++)
      ResourceTicks += Tick; // Добавили в ресурс тики

  MqlTick Ticks[];
  ResourceTicks.Get(Ticks); // Считали данные из ресурса.
  ArrayPrint(Ticks);        // Вывели.
  
  // Это полное имя ресурса для обращения из другой программы
  const string NameOut = StringSubstr(MQLInfoString(MQL_PROGRAM_PATH), StringLen(TerminalInfoString(TERMINAL_PATH)) + 5) + "::Ticks";  
  Print(NameOut); // Вывели полное имя ресурса.
  
  const RESOURCEDATA<MqlTick> Resource(NameOut); // Ресурс для доступа к данным (read-only) из другой программы
  
  MqlTick TicksOut[];
  Resource.Get(TicksOut); // Считали данные из ресурса.
  ArrayPrint(TicksOut);   // Вывели.
  
  Resource.Free();   // Не получится повлиять на данные read-only-ресурса.
  Print(_LastError); // ERR_INVALID_PARAMETER - Ошибочный параметр при вызове системной функции.
}
 
pivomoe, @fxsabe, thank you. I will look into it.
 

I don't understand how in this advisor

https://www.mql5.com/ru/code/20254

I can't figure out how to prevent the current (not yet formed) bar from being drawn. Can anyone give me a hint?

Renko 2.0 Offline
Renko 2.0 Offline
  • www.mql5.com
Неторгующий советник Renko 2.0 Offline генерирует информацию по пользовательскому символу на минутном графике. Полный график Ренко с фитилями. Доступен и оффлайн! Ссылается на библиотеку Symbol для MetaTrader 5, написанную пользователем fxsaber. Настраивается с...
 
EgorKim:

I don't understand how in this advisor

https://www.mql5.com/ru/code/20254

To prevent drawing of the current (not yet formed) bar. Can someone give me a hint?

You should ask in the Expert Advisor discussion thread).