Previous Next

GChartPatterns.Init()

This is used to prepare the data of GChartPatterns.

The call must still take place before the first call of a data-reading function.

void  GChartPatterns.Init(
   string   symbol = NULL,                         // Symbol
   string   Periodes = "MN1,W1,D1,H4,H1,M30,M15",  // Timeframes in short form
   int      ExtBarHistory = 700,                   // Number of bars to process
   int      TolerancePercent = 25,                 // Tolerance for deviation from price level
   int      ExtDepth = 12,                         // Minimum range between the same extreme points
   int      ExtDevitation = 5,                     // Percentage to reverse extreme points
   int      ExtBackstep = 3                        // Minimum distance between extrema
   );

Parameter

symbol

[in]  The symbol whose data the class is to process.

Periodes

[in]  The timeframes on which the class is to process the data. These are specified in short form and separated by a comma without spaces. "H1,W1" thus corresponds to PERIOD_H1 and PERIOD_W1 or 1 hour and 1 week.

ExtBarHistory

[in]  Number of bars to be processed. The more bars, the more past formations are displayed and taken into account in the probability calculation. High values can heavily load the processor.

TolerancePercent

[in]  The tolerance around the target points for the recognition of a formation. Smaller values mean that the formation must be executed more precisely. The tolerance is calculated dynamically on the movement of the last 20 bars.

ExtDepth

[in]  The minimum range in bars between two top- or bottom- extreme points that should be recognized as movement.

ExtDeviation

[in]  The percentage value for the reversal of an extreme point at which a Zig turns into a Zag again and vice versa.

ExtBackstep

[in]  The minimum range in bars between two extreme points that should be recognized as a movement.

Notice

The .Init() function call can be used at any point in the code. It can also be used multiple times to change data during runtime. However, it is recommended to call it at least once in the OnInit() and to check the data with .Ready() for completeness.


Example:

//--- Including the Glib class
#include <Glib.mqh>

//--- Creating a pointer to an empty class object
GChartPatterns *chartPatterns;


int OnInit ()
{
   //--- Assign the class to the empty class object
   chartPatterns = gChartPatterns();

   //--- Initialize the class data
   chartPatterns.Init();

   return(INIT_SUCCEEDED);
}

void OnDeinit (const int reason)
{
   //--- Release memory on exit
   delete chartPatterns;
}


See also

GChartPatterns, GChartPatterns.JustPaint, GChartPatterns.SetPaintBuild, GChartPatterns.SetPaintFinish, GChartPatterns.Ready, GChartPatterns.ChartEvent