Discussion of article "Timeseries in DoEasy library (part 35): Bar object and symbol timeseries list"

 

New article Timeseries in DoEasy library (part 35): Bar object and symbol timeseries list has been published:

This article starts a new series about the creation of the DoEasy library for easy and fast program development. In the current article, we will implement the library functionality for accessing and working with symbol timeseries data. We are going to create the Bar object storing the main and extended timeseries bar data, and place bar objects to the timeseries list for convenient search and sorting of the objects.

This article starts the new section in the description of the library for convenient development of programs for MetaTrader 5 and 4 terminals. The first series (34 articles) was devoted to the concept of library objects and their interconnections. The concept was used to develop the functionality for working with an account — its current status and history.

Currently, the library features the following functionality:

  • searching, sorting and comparing data of any order or position,
  • providing quick and convenient access to any order and position properties,
  • tracking any account event,
  • obtaining and comparing account and symbol data,
  • responding to property changes of all existing objects in databases (collections) and sending notifications of occurred events to the program.

We can also tell the library what events it should respond to and send notifications about the monitored events.

Besides, we have implemented the ability to work with the terminal trading functions. We have also developed new types of trading requests — pending trading requests that allow us to create the program behavior logic in various trading conditions, as well as provide the full set of features for creating new types of pending orders.
All this and much more was created and described in the previous series of the library development descriptions.


The second series of the library description considers many aspects of working with price data, symbol charts, market depths, indicators, etc. In general, the new series of articles is to be devoted to the development of the library functionality for quick access, search, comparison and sorting of any price data arrays, as well as their storage objects and sources.

Author: Artyom Trishkin

 

It's kind of unkosher to have a new CSeries class when there's one of the same name in SB.

Документация по MQL5: Стандартная библиотека / Индикаторы / Базовые классы / CSeries
Документация по MQL5: Стандартная библиотека / Индикаторы / Базовые классы / CSeries
  • www.mql5.com
Класс CSeries обеспечивает всем своим потомкам (классам таймсерий и индикаторов) возможность упрощенного доступа к общим функциям API MQL5 в части работы с серийными данными.
 
Denis Kirichenko:

It's kind of unkosher to have a new CSeries class when there's one of the same name in SB.

I agree. Thanks, I'll fix it.

 

A very important parameter of each bar is the time of the High price and the time of the Low price, or at least a flag indicating which of the two High or Low prices occurred first in time. This information can be obtained by analysing bars from a lower timeframe or directly from M1. Please add this functionality.

 
Rosimir Mateev:

A very important parameter of each bar is the time of the High price and the time of the Low price, or at least a flag indicating which of the two High or Low prices occurred first in time. This information can be obtained by analysing bars from a lower timeframe or directly from M1. Please add this functionality.

Such functionality can be done by yourself - there is all data on the lower timeframes, and there is all data on their bars. This is not the last article, and in the next ones there is a complete list of all timeframes of any symbol - so you should not overload the already existing one with unnecessary functionality. Especially since it will cause an increase in timeseries update time. Therefore, it is better to get data from already available ones on request than to do such analysis where it is not required.

 

Hi Artyom -- using DoEasy instead of the Standard Library, what is the best approach to create a class for detecting different candle patterns, similar to what is CCandlePattern as in https://www.mql5.com/en/code/316?

I am asking to avoid doing something that be completely contrary to the future direction you're taking with this library... I was thinking to either (1) modify or extend classes CBar & CSeries to do what I need; or (2) or use the DoEasy events to detect new bars on the symbols/periods I am interested in, from there implement my code to check for my candle patterns and use DoEasy again to place orders or open positions. Maybe option #2 is cleaner and less risky relative to your future developments, but let me know if you have another suggestion please.

acandlepatterns.mqh

class CCandlePattern : public CExpertSignal
  {
protected:

// ...

   //--- methods, used for check of the candlestick pattern formation
   double            AvgBody(int ind);
   double            MA(int ind)                const { return(m_MA.Main(ind));             }
   double            Open(int ind)              const { return(m_open.GetData(ind));        }
   double            High(int ind)              const { return(m_high.GetData(ind));        }
   double            Low(int ind)               const { return(m_low.GetData(ind));         }
   double            Close(int ind)             const { return(m_close.GetData(ind));       }
   double            CloseAvg(int ind)          const { return(MA(ind));                    }
   double            MidPoint(int ind)          const { return(0.5*(High(ind)+Low(ind)));   }
   double            MidOpenClose(int ind)      const { return(0.5*(Open(ind)+Close(ind))); }
   //--- methods for checking of candlestick patterns
   bool              CheckPatternThreeBlackCrows();
   bool              CheckPatternThreeWhiteSoldiers();
   bool              CheckPatternDarkCloudCover();
   bool              CheckPatternPiercingLine();
   bool              CheckPatternMorningDoji();
   bool              CheckPatternEveningDoji();
   bool              CheckPatternBearishEngulfing();
   bool              CheckPatternBullishEngulfing();
   bool              CheckPatternEveningStar();
   bool              CheckPatternMorningStar();
   bool              CheckPatternHammer();
   bool              CheckPatternHangingMan();

MQL5 Wizard - Trade Signals Based on Hammer/Hanging Man + MFI
MQL5 Wizard - Trade Signals Based on Hammer/Hanging Man + MFI
  • www.mql5.com
The generic idea is the following: the class of trading signals is derived from CExpertSignal, the next, it's necessary to override the LongCondition() and ShortCondition() virtual methods with your own methods. The best way is to create the separate class, derived from CExpertSignal for checking of formation of candlestick patterns. For...
 
ddiall :

Hi Artyom --  using DoEasy instead of the Standard Library,  what is the best approach to create a class for detecting different candle patterns, similar to what is CCandlePattern  as in  https://www.mql5.com/en/code/316 ?

I am asking to avoid doing something that be completely contrary to the future direction you're taking with this library... I was thinking to either (1)   modify or extend  classes CBar & CSeries to do what I need; or (2)  or use the DoEasy events to detect new bars on the symbols/periods I am interested in, from there implement my code to check for my candle patterns and use DoEasy again to place orders or open positions. Maybe option #2 is cleaner and less risky relative to your future developments, but let me know if you have another suggestion please.

acandlepatterns.mqh

class  CCandlePattern :  public  CExpertSignal
  {
protected :

// ...

    //--- methods, used for check of the candlestick pattern formation
    double             AvgBody( int  ind);
    double             MA( int  ind)                 const  {  return (m_MA.Main(ind));             }
    double             Open( int  ind)               const  {  return (m_open.GetData(ind));        }
    double             High( int  ind)               const  {  return (m_high.GetData(ind));        }
    double             Low( int  ind)                const  {  return (m_low.GetData(ind));         }
    double             Close( int  ind)              const  {  return (m_close.GetData(ind));       }
    double             CloseAvg( int  ind)           const  {  return ( MA(ind) );                    }
    double             MidPoint( int  ind)           const  {  return ( 0.5 *(High(ind)+Low(ind)) );   }
    double             MidOpenClose( int  ind)       const  {  return ( 0.5 *(Open(ind)+Close(ind)) ); }
    //--- methods for checking of candlestick patterns
    bool               CheckPatternThreeBlackCrows();
    bool               CheckPatternThreeWhiteSoldiers();
    bool               CheckPatternDarkCloudCover();
    bool               CheckPatternPiercingLine();
    bool               CheckPatternMorningDoji();
    bool               CheckPatternEveningDoji();
    bool               CheckPatternBearishEngulfing();
    bool               CheckPatternBullishEngulfing();
    bool               CheckPatternEveningStar();
    bool               CheckPatternMorningStar();
    bool               CheckPatternHammer();
    bool               CheckPatternHangingMan();

The library will contain a class for searching for PriceAction candlestick patterns and various Japanese candlestick formations.

I find it most prudent to add a new property to the CBar object class. Accordingly, the collection of timeseries will be able to search for the desired candles and patterns.

So it will be in the library.

For now, you can search for the patterns and candles you need in the lists of the collection of timeseries - there are all the bars, and you can use them to determine the pattern.

 
Artyom Trishkin:

The library will contain a class for searching for PriceAction candlestick patterns and various Japanese candlestick formations.

I find it most prudent to add a new property to the CBar object class. Accordingly, the collection of timeseries will be able to search for the desired candles and patterns.

So it will be in the library.

For now, you can search for the patterns and candles you need in the lists of the collection of timeseries - there are all the bars, and you can use them to determine the pattern.

That sounds great! Any idea when you will start implementing all this good stuff? Are you interested in any code contributions?

 
Dima Diall :

That sounds great! Any idea when you will start implementing all this good stuff? Are you interested in any code contributions?

As the time comes :)