• Overview
  • Reviews (3)
  • Comments (1)

Custom Chart Demo

iCustomChartDemo indicator is a demo version of iCustomChart. iCustomChart indicator allows to create custom charts based on custom history files. Open history file format is used.

The demo version creates a copy of the chart it has been launched on by default allowing to observe iCustomChart possibilities. It saves a symbol history file used during the demonstration but does not allow to use custom history files. The chart created by iCustomChartDemo shows the work of the indicators and the Expert Advisors created with the use of the free LibCustomChart library. Also, you can experiment with graphical objects.

Contents:
  1. Advantages and Features
  2. Input Parameters
  3. Indicator Buffers
  4. Data Window
  5. History Files
  6. Graphical Objects for Technical Analysis
  7. Indicators and Experts

1. Advantages and Features

  • works at any open chart window (called "base chart" further on in this document);
  • looks like a common chart after uploading (see Screenshots);
  • open history file format is used;
  • MetaTrader 4 and 5 data format can be used;
  • allows to create the charts of synthetic or non-standard symbols;
  • has built-in Data Window (see Screenshot 4);
  • major part of the objects from the MetaTrader 5 standard set can be used for technical analysis (see Screenshot 2);
  • both online and offline charts can be created;
  • bars opening time can be controlled up to milliseconds;
  • user indicators and Expert Advisors can be created based on synthetic symbol chart (see Screenshots 3, 6).

2. Input Parameters

  • Historical file - history file name, may contain subfolders. All history files are located in the "terminal_data_folder\MQL5\Files\iCustomChart\History" directory and searched relative to this folder.
  • Max bars in chart - allows to display a fixed number of bars in a chart window. Parameter zero value allows to display the maximum possible number of bars, but not more than the number specified in the client terminal settings. This parameter acts as the equivalent parameter of the client terminal described in Help. The default value is 1000.
  • Update - iCustomChart indicator update method:
                   Disable - update disabled, set by default;
                   Ticks    - update at each base chart tick;
                   Bars     - update when a new bar appears on a base chart.
    Note: access to the history file is carried out in case the update is enabled. There is no sense in enabling this mode, if the history file is not updated.
  • Shadows - managing candlestick shadows drawing. This parameter is useful when creating some non-standard charts, for example, Renko:
                   Enable  - shadow display enabled, set by default; 
                   Disable - shadow display disabled.
  • Data scale - display the time scale on a chart. 
                   Enable - time scale display enabled, set by default; 
                   Disable - time scale display disabled.
  • Value of zero buffer - zero buffer value calculated according to selected price constant.

3. Indicator Buffers

Indicator buffer indexContents
0 Contains selected price constant. The buffer allows other indicators that use the first form to get the data.
1 Bar opening time
2 Bar opening price
3 Bar high price 
4 Bar low price 
5 Bar closing price
6 Bar color 
7 Market volume
8 Tick volume
9 Spread

4. Data Window

Built-in data window looks similar to the conventional MetaTrader 5 data window but has some additions (Screenshot 4). Data fields displayed in the window:

  • Upper field - symbol name and parameter. Parameter is the value of the "parameter" variable of a history file header (see description of a history file format). Parameter standard values mean selected symbol period. The window containing data on a history file will be downloaded after this field is clicked on (Screenshot 5).
  • Date            - bar opening date.
  • Time            - bar opening time.
  • Open           - bar opening price.
  • High            - bar high price.
  • Low             - bar low price.
  • Close           - bar closing price.
  • Volume        - market volume.
  • Tick Volume - tick volume.
  • Spread        - bar spread.
  • Bar              - bar index, zero bar - last unfinished bar.
5. History Files (HST Files)
Open history files format described in the MetaTrader 4 user guide. Users can take a ready-made history file or create it themselves. Then iCustomChart indicator can be used for a chart display.
History file format is the following one. History file header goes first:
struct HistoryHeader
{
  int		version		// base version
  char		copyright[64];	// copyright
  char		symbol[12];	// symbol
  int		parameter;    // symbol period or parameter
  int		digits;       // number of digits after the decimal point in a symbol
  time_t	timesign;     // base creation time sign
  time_t        last_sync;  // last synchronization time
  int		unused[13];	// for future use
};
The version of the base for MetaTrader 4 history files is displayed as "400", while for MetaTrader 5 it is "500". This is important, as each version has its own bar data structure.
The standard representation of the bars array following the header for the version "400" history file looks as follows:
#pragma pack(push,1)
struct RateInfo
{
 time_t   ctm;	// time in seconds
 double	  open;		// bar opening price
 double	  low;		// bar low price
 double   high;	// bar high price
 double   close;	// bar closing price
 double   vol;		// volume
};
#pragma pack(pop)
The standard representation of the bars array for the version "500" history file looks as follows:
#pragma pack(push,1)
struct MqlRates
{
 datetime time;         // bar time in seconds or milliseconds
 double   open;         // open price
 double   high;         // high price for the period
 double   low;          // low price for the period
 double   close;        // closing price
 long     tick_volume;  // tick volume
 int      spread;       // spread
 long     real_volume;  // market volume 
};
#pragma pack(pop)

Note that bar time can be set either in seconds or in milliseconds for version "500". iCustomChart can correctly recognize both time formats.

Note: users bear responsibility for a history file correctness.

6. Graphical Objects for Technical Analysis
Standard graphical objects of the terminal are bound to a base chart time scale when placed in a chart window. Time scale of custom charts created using iCustomChart does not always coincide with a base chart time scale. Therefore, iCustomChart automatically binds used graphical objects to its time scale. Synchronization with iCustomChart is supported for the following conventional MetaTrader 5 graphical objects:
  • lines: horizontal, vertical, trendlines, trends by angle, cycle, arrowed;
  • channels: equidistant, Andrews Pitchfork;
  • Fibonacci: retracement, time zones, fan, arcs, channel, expansion;
  • Elliott: motive wave, corrective wave;
  • shapes: triangle, rectangle, ellipse;
  • arrows: thumbs up, thumbs down, arrow down, arrow up, stop sign, check sign, left and right price labels, Buy and Sell signs, arrow.
In some cases, for example when closing the terminal, iCustomChart saves the objects data to a temporary file located in the "terminal_data_folder\MQL5\Files\iCustomChart\Objects" directory. The system deletes all temporary files when iCustomChart is being removed from a chart window.
7. Indicators and Experts
Common indicators follow the time scale of a base chart, as well as the objects. Free LibCustomChart library should be used for binding the indicators to the iCustomChart time scale.
The library functions allow to write the indicators that are automatically connected to iCustomChart (Screenshot 3), in case it is uploaded to a chart window. In case iCustomChart is not uploaded, these indicators will work in a common chart window. Besides, the library provides simplified access to iCustomChart time series.
In case the library functions are used in an Expert Advisor, then it will also automatically use iCustomChart data, in case the latter has already been uploaded to a chart window. In case iCustomChart is not uploaded, the Expert Advisor will work in a common chart window and use its data.
Examples of the library use in indicators and Expert Advisors can be found in Code Base.
Nork
3491
2016.06.16 08:30 
 

User didn't leave any comment to the rating

Rodrigo da Silva Boa
7105
2016.01.10 22:52 
 

User didn't leave any comment to the rating

Vadim Strelkov
7875
2014.04.03 08:39 
 

User didn't leave any comment to the rating