Previous Next

GSupportAndResistance.Init()

Used to prepare the data of GSupportAndResistance.

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

void  GSupportAndResistance.Init(
   string   symbol = NULL,                              // Symbol
   string   Periodes = "MN1,W1,D1,H4,H1,M30,M15",       // Timeframes in short form
   bool     OnlyUncut = false,                          // Only use supports and resistances that have not yet been broken
   int      MinTouches = 2,                             // Minimum number of touches to create a support or resistance
   int      ExtBarHistory = 700,                        // Number of bars to process
   int      TolerancePercent = 7,                       // Tolerance for deviation from price level
   int      ExtDepth = 6,                               // Minimum range between the same extreme points
   int      ExtDevitation = 5,                          // Percentage for reversal of extreme points
   int      ExtBackstep = 3                             // Minimum range between extreme points
   );

Parameter

symbol

[in]  The symbol of which the data is to be processed by the class.

Periods

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

OnlyUncut

[in]  If set to true only support and resistance levels are used that have not been broken yet.

MinTouches

[in]  Minimum number of touches to create a resistance or support.

ExtBarHistory

[in]  Number of bars to be processed. The more bars, the more past extreme points are taken into account.

TolerancePercent

[in]  The tolerance around the first extremum to create a support or resistance. Smaller values lead to the need for a repeated touch of the price level to be more precise. The tolerance is calculated dynamically based 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.

ExtDevitation

[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 extremes that should be recognized as a movement.

Hinweis

The .Init() function call can be made at any location 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 check the data with .Ready() for completeness.


Example:

//--- Include Glib classes
#include <Glib.mqh>

//--- Creation of a pointer to an empty class object
GSupportAndResistance *supportAndResistance;


int OnInit ()
{
   //--- Assign the class to the empty class object
   supportAndResistance = gSupportAndResistance();

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

   return(INIT_SUCCEEDED);
}

void OnDeinit (const int reason)
{
   //--- Free up memory on exit
   delete supportAndResistance;
}


See also

SupportAndResistance, GSupportAndResistance.InitPivots, GSupportAndResistance.SetMarkersLengthRight, GSupportAndResistance.SetFontSize, GSupportAndResistance.Ready