To start the installation process download the latest plug-in and follow these steps:
First, open MT4 and make sure that you have enabled DLL imports. This is done in the Expert Advisors tab of the MT4’s Options window (you can press CTRL-O to bring up this window in MT4):
Make sure that you have enabled “Allow DLL imports” as presented on the screen above. “Allow automated trading” can also be enabled, but it is not required for the plug-in to work correctly.
The screen above may look different in various MT4 builds, but the “Allow DLL imports” option is present in all of them.
When finished with the above, you’ll need to close MT4 and run the downloaded RangeBars setup program. When you run the setup program you will see a window similar to the following one:
After clicking [Next > ], you’ll need to accept the license agreement and select the installation folder where RangeBars should be installed. This needs to be your MT4 installation folder (not the /experts, /experts/indicators or any other sub-folder). The installed files will automatically be synchronized with your data folder, so no manual file copying is required.
The illustration above is only an example. You’ll need to select your own MT4 installation folder, which is where you installed Metatrader and where terminal.exe is located.
When in doubt please read this short guide.
The installation process will begin once you select the destination location, click [ OK ] and pressing [NEXT >].
Once the installation process is complete, you’ll need to activate the software using the “Activate.exe” utility. The activation process is described in the readme file on google drive.
Using the RangeBars plug-in
To use the plug-in, first attach the RangeBarChart_b574 custom indicator to an M1 chart of the chosen instrument (i.e. currency pair, index, etc.). This can do this by dragging the indicator from the Navigator window’s Custom Indicators branch onto the selected M1 chart or by double-clicking the indicator name (RangeBarChart on the picture below) in the Navigator window.
This action will bring up the following screen, where you can set the plug-in parameters:
The variables and their meaning are described below:
- Range bar size in pips for FX (in points for others)This variable influences the size of each bar (range from high to low). On Forex symbols this simply means how many regular pips will each candle measure.
When using the plug-in with CFDs, Indices, etc., the range bar size value will reflect the number of points (from high to low) that each candle will measure.
- OfflineTimeFrameThis variable reflects the output time frame for the actual chart. Remember that the time value has no meaning here whatsoever. It describes a unique “chart ID” which will display the live RangeBar chart. You can input any value here as long as you do NOT use the standard MT4 time frames (1,5,15,30,60,240,1440, etc.) and you do not use the same values which are already in use by other plug-ins. You can leave this setting at default (3) if you are only going to use one RangeBars chart per instrument.
An optional feature, which ensures daily (or session) reference consistency. This is used to reflect the true daily (or session) open, high, low and close values. To use this function, set ResetOpenOnNewTradingDay to true. As a result, you may even see a gap between the previous session’s close and open of the current one.
- RenderUsing1MhistoryBarsThis variable defines the count of historical bars on the M1 chart that will be used to render the historical range bar chart.
A setting of 0 will result in using all available data on the M1 chart.
- StartFromBarThis variable is used for setting the date & time of the first 1M bar, which will be used to calculate the first historical range bar.
The default value of “1970.01.01 00:00” disables the feature.
- RefreshOnHistoryUpdatesWhen the value is set to TRUE, the Range chart will be recalculated whenever the terminal receives missing M1 historical data for the calculated instrument. This is usually needed if you have a poor internet connection with your broker’s MT4 server.
- RefreshChartOnAskPriceChangeWhen this value is set to TRUE the plug-in will send a synthetic update tick to the range bar chart whenever the Asking price changes. When set to FALSE the update tick will only be sent on Bid price changes.
This setting is intended to be used for running an EA directly from the range chart.
You have to decide if your EA needs to recalculate on ASK price changes or will BID price changes be sufficient. Keep this setting at FALSE for normal usage (saves some CPU cycles).
- chartUpdateIntervalThis feature is designed to lower CPU usage for manual traders or traders needing many range bar charts. The parameter offers the ability to set the lowest update interval time in milliseconds. It is recommended to use the default value. A value of “0” turns the feature OFF.
- Dynamic Bar Size Setting section
This section consists of 3 variables that automatically calculate the bar’s range (high to low) based on a percentage of the daily ATR value:
- Use ATR to calculate the candle size (true/false) – A setting of FALSE will disable the feature and the size provided in the first input (Range bar size..) will be used.
- ATR period (default value is set to 14)
- Percentage of ATR (range bar size) (0.01 = 1%, 1.00 = 100%, etc.)
Once you set the values described above to the desired settings and press the [ OK ] button you will see the following comment in the lower part of the M1 anchor chart:
Now you need to open the generated offline chart (i.e. EURUSD,M2 – as shown in the comment displayed above) to access the LIVE RangeBar chart. To do this go to the File menu in your MT4 terminal and click on the Open Offline menu item:
This will open the Open Offline Chart window, where you’ll need to locate the appropriate chart on the list (EURUSD,M2 in our example) and click [ OPEN ] to access the Range chart in your terminal.
The “offline” chart will start displaying live price action as soon as new quotes are received by MT4 and new range bars will be created as they are formed.
Please note that every time the plug-in is attached (or MT4 terminal is restarted) it will recalculate all historical data so keep this in mind when you set the “RenderUsing1MhistoryBars” to 0 (all of history).
There are two valid ways of backtesting range bar charts in MT4 – both have been described in separate blog posts:
- Backtesting using completed bar analysis only (this method is very old and is not recommended)
- Backtesting using tick data (every tick is backtested and taken into account)
Updating the plug-in to the latest version
The plug-in(s) can be easily updated once new plug-in features or bug fixes are released.
To update your plug-in close your MT4 terminal and run the updater program which will automatically check for newer versions, download the new files and patch your existing plug-in installation. If you have multiple MT4 installations on your system, you should update all instances by using the updateRangeBarsPlugin.bat file, which is located in your MT4 installation folder.