거래 로봇을 무료로 다운로드 하는 법을 시청해보세요
당사를 Telegram에서 찾아주십시오!
당사 팬 페이지에 가입하십시오
스크립트가 흥미로우신가요?
그렇다면 링크 to it -
하셔서 다른 이들이 평가할 수 있도록 해보세요
스크립트가 마음에 드시나요? MetaTrader 5 터미널에서 시도해보십시오
라이브러리

The simplified class of the CArrayRing256 ring buffer - MetaTrader 5용 라이브러리

조회수:
4043
평가:
(30)
게시됨:
2013.01.07 15:45
\MQL5\Include\IncOnRingBuffer\
이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동

Description

The CArrayRing256 class is the simplified version of the CArrayRing ring buffer, but it is faster and allows to organize the mini time series, indicator minibuffers, short sized buffers to store intermediate stream data inside the Expert Advisor or indicator. 

Simplification based on the property of uchar-variable, which is used as the array index. For example, in the code

double array[UCHAR_MAX+1];  // the ring buffer data
uchar  index=0;             // the buffer element index

while(!IsStopped())
  {
   array[++index];          // go to the next element of the buffer
   ...
  }

the array index always takes the value from 0 to 255 and never go beyond the range of the array dimension. It allows to remove all checking from the methods associated with the possible exit of the index beyond the array exit by simplifying the methods themselves and increasing rate of performance. But the buffer size will be always constant and has the size of 256 elements. For many tasks this is an acceptable alternative to the universal class of CArrayRing in exchange for an increase the rate of the work.

Declaration

сlass CArrayRing256

Title

#include <IncOnRingBuffer\CArrayRing256.mqh>

The CArrayRing256.mqh class file should be placed in the IncOnRingBuffer folder that need to be established in MQL5\Include\.

Class methods 

//--- buffer initialization method:
void Init(
   double volue=EMPTY_VALUE // value for empty location buffers
   );
//--- addition method of new element into the buffer:
void Add(
   const double element     // added element value
   ); 
//--- the method rewrites the elements value with the set index:
void Update(                // if error it returns false, if successful - true
   const double element,    // the new value of the element
   const uchar  index=0     // the element index
   );  
//--- the method returns the value of the element with the set index:
double At(                  // returns the value of the element
   const uchar index        // the element index
   ) const;
//--- method returns value of the last written in the buffer element:
double Last() const;
//--- method overwrites last element value in the buffer:
void Last(
   const double element     // new value of the element
   );  
//--- method returns ring buffer size:
int Size();

Note:

  • the size of the ring buffer is always constant and equal to 256 elements
  • in the given realization of the ring buffer the indexing is taken as in a timeseries, i.e. opposite to the usual 

Examples

Use of this class is similar to CArrayRing . There are a couple of differences:

  • The Init() method is used for initialization of the buffer by the definite value;
  • The Resize() method is absent as the size of the buffer is always constant.

MetaQuotes Ltd에서 러시아어로 번역함.
원본 코드: https://www.mql5.com/ru/code/1379

Breakout Bars Trend v2 Breakout Bars Trend v2

The second (edited and added) version of the alternative indicator for trend definition based on the breakthrough bars and distance from extremums. The breakthrough levels and size of the previous trends are added.

Exp_VininI_Trend_LRMA Exp_VininI_Trend_LRMA

The Exp_VininI_Trend_LRMA trading system is based on changes of the trend direction displayed by the VininI_Trend_LRMA indicator.

The example of the work with the CSV file as with a table The example of the work with the CSV file as with a table

The CSV file was written to write economic news but there was a problem that the Terminal does not distinguish lines, exactly their number when working with the CSV file. That is why I decided to share my solution of this problem.

X-bars Fractals X-bars Fractals

The X-bars Fractals indicator allows setting the number of bars on the left and the right from fractal. It is good as for local, so for global extremums