Skip to content

Chart Timeframes

Chart Timeframes

All predefined timeframes of charts have unique identifiers. The PERIOD_CURRENT identifier means the current period of a chart, at which a mql5-program is running.

ENUM_TIMEFRAMES

IDDescription
PERIOD_CURRENTCurrent timeframe
PERIOD_M11 minute
PERIOD_M22 minutes
PERIOD_M33 minutes
PERIOD_M44 minutes
PERIOD_M55 minutes
PERIOD_M66 minutes
PERIOD_M1010 minutes
PERIOD_M1212 minutes
PERIOD_M1515 minutes
PERIOD_M2020 minutes
PERIOD_M3030 minutes
PERIOD_H11 hour
PERIOD_H22 hours
PERIOD_H33 hours
PERIOD_H44 hours
PERIOD_H66 hours
PERIOD_H88 hours
PERIOD_H1212 hours
PERIOD_D11 day
PERIOD_W11 week
PERIOD_MN11 month

Example:

string chart_name="test_Object_Chart";
   Print("Let's try to create a Chart object with the name ",chart_name);
//--- If such an object does not exist - create it
   if(ObjectFind(0,chart_name)<0)ObjectCreate(0,chart_name,OBJ_CHART,0,0,0,0,0);
//--- Define symbol
   ObjectSetString(0,chart_name,OBJPROP_SYMBOL,"EURUSD");
//--- Set X coordinate of the anchor point
   ObjectSetInteger(0,chart_name,OBJPROP_XDISTANCE,100);
//--- Set Y coordinate of the anchor point
   ObjectSetInteger(0,chart_name,OBJPROP_YDISTANCE,100);
//--- Set the width of chart
   ObjectSetInteger(0,chart_name,OBJPROP_XSIZE,400);
//--- Set the height
   ObjectSetInteger(0,chart_name,OBJPROP_YSIZE,300);
//--- Set the timeframe
   ObjectSetInteger(0,chart_name,OBJPROP_PERIOD,PERIOD_D1);
//--- Set scale (from 0 to 5)
   ObjectSetDouble(0,chart_name,OBJPROP_SCALE,4);
//--- Disable selection by a mouse
   ObjectSetInteger(0,chart_name,OBJPROP_SELECTABLE,false);

Timeseries identifiers

The identifiers of timeseries are used in the iHighest() and iLowest() functions. They can be equal to a value the enumeration

ENUM_SERIESMODE

IdentifierDescription
MODE_OPENOpening price
MODE_LOWLow price
MODE_HIGHHigh price
MODE_CLOSEClose price
MODE_VOLUMETick volume
MODE_REAL_VOLUMEReal volume
MODE_SPREADSpread

See also

PeriodSeconds, Period, Date and Time, Visibility of objects

Last updated on