• Overview
  • Reviews
  • Comments (21)
  • What's new

Renko Charts

The iRenkoChart indicator allows creating custom Renko charts. It uses an open format of history files, easy switching between the charts based on Bid and Ask prices, history quality control, ability to use the Expert Advisors, indicators and chart objects for technical analysis and many other things.

This indicator is based on iCustomChart and represents its particular implementation. iCustomChart demo version can be downloaded for free.

Contents:

  1. Advantages and Features
  2. Input Parameters
  3. Indicator Buffers
  4. Data Window
  5. History Files
  6. History Quality Control
  7. Time Scale
  8. Graphical Objects for Technical Analysis
  9. Indicators and Experts

1. Advantages and Features

  • runs and works at any open chart window (called "base chart" further on in this document);
  • looks like a common chart after launching (see Screenshots);
  • to get started, previously created history files are not required;
  • open history file format is used;
  • MetaTrader 4 and MetaTrader 5 data format can be used;
  • easy switching between charts based on Bid or Ask prices;
  • history quality control (see Screenshot 7);
  • full format of history including open time of boxes (bars), spread, tick and exchange volume;
  • built-in Data Window (see Screenshot 4);
  • built-in Time Scale (see Screenshot 6);
  • auto scaling of price scale;
  • major part of the objects from the MetaTrader 5 standard set can be used for technical analysis (see Screenshot 2);
  • displaying online and offline charts;
  • controlling bars open time up to milliseconds;
  • custom indicators and Expert Advisors can be created based on the iRenkoChart chart using LibCustomChart (see Screenshots 3, 8).

2. Input Parameters

  • Max bars in chart - allows displaying a fixed number of bars (boxes) in a chart window. Zero value of the parameter allows displaying the maximum possible number of bars, but no 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.
  • Size of box - range or size of boxes (bars) in points from open price to close price. The default value is 200.
  • Value of zero buffer - zero buffer value calculated according to selected price constant.

3. Indicator Buffers

Indicator Buffer Number Content
0 Contains selected price constant. The buffer is basically created for other indicators that use the first call form to get data.
1 Bar (box) open time.
2 Bar open price.
3 Bar high price.
4 Bar low price.
5 Bar closing price.
6 Bar color.
7 Exchange volume.
8 Tick volume.
9 Spread.

4. Data Window

Built-in data window looks similar to the standard MetaTrader 5 data window, but has some additional features (Screenshot 4). Data fields displayed in the window:

  • Upper field - symbol name and parameter. Parameter is a size of bar in points (Size of box), specified in the indicator input parameters. The window containing data on a history file will be opened once you click on this field (Screenshot 5).
  • Date - bar open date.
  • Time - bar open time.
  • Open - bar open price.
  • High - bar high price.
  • Low - bar low price.
  • Close - bar close price.
  • Volume - exchange volume.
  • Tick Volume - tick volume.
  • Spread - bar spread.
  • Bar - bar index; zero bar - last unfinished bar.

Data window has several buttons to control the chart:

  • Shadows - enables/disables displaying shadows, the same action is executed by pressing the "S" key;
  • Update - enables/disables the chart update mode ("U" hot key);
  • Bid/Ask - switches the chart to displaying using Bid or Ask prices ("B" and "A" hot keys, respectively);
  • Open/Close - the button for opening/closing the data window is located in the upper right corner of the data window ("W" hot key);
  • Redraw - chart redraw button is located near the data window close button ("R" hot key).

Hot keys work only in an active chart window.

5. History files (HST-files)

Open history files format described in the MetaTrader 4 user guide is used to draw charts. A user can take a ready-made Renko history file or create one on their own. Then the iRenkoChart indicator can be used to display a chart.

History file format is as following. The 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, for iRenkoChart it is "Size of box" input parameter value
  int     digits;       // number of digits after the decimal point in a symbol
  time_t  timesign;     // base creation timestamp
  time_t  last_sync;    // last synchronization time
  int     type;         // type of history stored, 1 - Ask-history, 2 - Bid-history,
                        // any other value of the parameter - history type is not identified
  int     unused[12];   // for future use
};

Note that a new "type" parameter is added into the standard header.

The version of the base for MetaTrader 4 history files is specified 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" of history file looks as follows:

#pragma pack(push,1)
struct RateInfo
{
 time_t  ctm;	  // time in seconds
 double	  open;	  // bar open price
 double	  low;     // bar low price
 double   high;   // bar high price
 double   close;  // bar close price
 double   vol;	 // volume
};
#pragma pack(pop)

The standard representation of the bars array for the version "500" of history file looks as follows:

#pragma pack(push,1)
struct MqlRates
{
 datetime time;         // bar time in seconds or mulliseconds
 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". iRenkoChart can correctly recognize both time formats.
Important: users are responsible for the correctness of history files.

To make iRenkoChart recognize a history file, it must be located in "terminal_data_folder\MQL5\Files\iRenkoChart\History\broker_ name".

  1. The history file name must start with "Renko" prefix. Before the prefix you can add "Ask" or "Bid", if the file contains the corresponding type of history;
  2. Then it must contain the symbol name on the base chart of which the indicator will be loaded (for example, "EURUSD");
  3. Then it must contain the value of the "Size of box" input parameter;
  4. Finally it must have the ".hst" extension.

An example of the file name: AskRenkoEURUSD200.hst.

If the history file doesn't exist, it will be automatically created from the minute history available in the terminal. If it exists, it will be updated in accordance with the built-in algorithm.

6. History Quality Control

For history files created by iRenkoChart, history quality control is available.

Any new history file is created from the minute history available in the terminal. Accordingly, there can be situations when the simulated bars can differ from bars created online. Each doubtful simulated bar on the chart is displayed in lighter color than correct bars (Screenshot 7). It allows estimating history quality visually.

When initializing the indicator or switching between Bid and Ask price histories, a message about its quality will appear in the log (Screenshot 7). It can be estimated in the percentage of good and bad bars. Please note that history quality calculation is performed only for bars displayed on charts, not for the whole history file.

Gaps are also considered when forming the history. Gaps are visually displayed in the form of gray bars and with zero volume on default.

Using the indicator buffer "Bar color" you can programmatically estimate the history quality in your own indicators and the Expert Advisors. It allows making adequate solutions when implementing a trading strategy.

You can improve the history quality using iRenkoChart in the online mode only. At coming of tick data iRenkoChart correctly calculates all parameters of bars and saves them in the history file. For example, bar open time will be calculated to milliseconds and saved. If there is no tick data to build history for a period of time (connection failure, terminal is turned off or any other nonstandard situation), so the missing Renko history will be formed on the basis of a minute history. 

7. Time Scale

Time scale of charts created using iRenkoChart, does not usually coincide with a base chart time scale and it is non-linear. Therefore, the indicator is built to visualize a custom time scale (see Screenshot 6). Built-in scale features:

  • looks similar to the standard time scale;
  • easy to move vertically;
  • semi-transparent background, always visible chart objects and price chart behind the scale.

8. 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. Therefore, iRenkoChart automatically rebinds applied graphical objects to its time scale. It allows using the standard graphical objects for technical analysis of Renko charts. Synchronization with iRenkoChart is supported for the following standard MetaTrader 5 graphical objects:

  • lines: horizontal, vertical, trend, trend by angle, cycle, arrowed;
  • channels: equidistant, Andrews Pitchfork;
  • Fibonacci tools: retracement, time zones, fan, arcs, channel, expansion;
  • Elliott tools: 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, iRenkoChart saves the objects data to a temporary file located in the "terminal_data_folder\MQL5\Files\iRenkoChart\Objects" directory. All temporary files are deleted when iRenkoChart is removed from a chart window.

9. Indicators and Experts

Standard 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 iRenkoChart time scale.

The library functions allow developing indicators that are automatically connected to iRenkoChart (Screenshot 3), if it is run on a chart. In case it is not run, these indicators will work on a common chart. Besides, the library provides simplified access to iRenkoChart time series.

In case the library functions are used in an Expert Advisor, then it will also automatically use iRenkoChart data, in case the latter has already been run on a chart window. In case iRenkoChart is not run, the Expert Advisor will work on a common chart window and use its data.

Examples of the library use in indicators and the Expert Advisors can be found in Code Base.

This indicator is based on iCustomChart and represents its particular implementation. iCustomChart demo version can be downloaded for free.
No reviews
Version 1.17 - 2015.04.29
1. 'Offset' input parameter renamed to 'Type of chart'. It has three values:
Standard Renko - Renko chart is created according to the standard algorithm;
Price frame - box open price is always equal to the previous box close price;
Mediam Renko - box open price is equal to the average value of the previous box open and close prices.
2. Added display of the box OHLC values in MetaTrader 5 conventional data window.
Version 1.16 - 2015.03.20
1. Fixed display of the Renko chart, if the input "Max bars in chart" is greater than the number of bars on the chart.
2. Added a filter against zero quotes, which could lead to incorrect display of the Renko chart.
Version 1.15 - 2015.03.11
1. Fixed an error that occasionally caused incorrect display of the Renko chart when reading a history file after losing connection to a server.
2. Optimized the code of working with history files.
Version 1.14 - 2014.09.24
1. Fixed error when working with symbol names exceeding 12 characters in length.
2. Optimized code to display time scale.
Version 1.13 - 2014.06.23
Fixed creating a folder for history file in case there are special characters in the broker name.
Version 1.12 - 2013.09.03
Now it is allowed to use the indicator in the strategy tester. Testing in the visual mode is still disabled.
Version 1.11 - 2013.06.21
1. Added the parameter "Offset" in previous versions. If it set to "OFF", a Renko chart is displayed. If it is "ON", a Price frame chart is displayed. The only difference from Renko is the reverse boxes start forming once the previous box has been closed.
2. Fixed the error of synchronization of graphical objects with iRenkoChart that could appear after restarting the terminal.
3. Fixed displaying of colors when selecting one of three predefined color schemes of a chart.