Previous Next

GSupportAndResistance.Paint()

Draws the selected support and resistance lines, as well as pivot points automatically on the chart.

void  GSupportAndResistance.Paint(
   ENUM_SUPPORTANDRESISTANCE  kind = SAR_ALL,  // To be drawn lines: SAR_ALL, SAR_SUPPORT, SAR_RESISTANCE or SAR_PIVOT
   ENUM_TIMEFRAMES            timeFrame = -1   // Timeframe of the values
   );

Parameter

kind

[in]  The data to be drawn. Allowed are SAR_ALL, SAR_SUPPORT, SAR_RESISTANCE or SAR_PIVOT. See ENUM_SUPPORTANDRESISTANCE.

timeFrame

[in]  timeframe of the prices to be drawn. -1 draws all active timeframes.

Return value

In case of success, the desired values are automatically drawn on the chart.


Example:

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

//--- Generation 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;
}


void OnTick ()
{
   if ( supportAndResistance.Ready() ) //--- Will only be executed when all data is ready
   {
      //--- Draw set data on the chart
      supportAndResistance.Paint();
   }
}


See also

GSupportAndResistance.ClearPaint, GSupportAndResistance.SetFontSize, GSupportAndResistance.SetMarkersLengthRight