Custom offline charts in MetaTrader 4

When you click on the File dialog at the top of MetaTrader, one of the top options is “Open Offline.” Most people have no idea what that option does or why it is useful.

Offline charts offer the ability to display custom time frames, although doing so requires programming a custom script. Scripts sort through data on regular charts, then the code rearranges that data into a new time frame. The new time frame appears in offline charts.

Experiment on your own with one of MT4’s default scripts:

Open the navigator. Identify the script called “period_converter.”Drag and drop the script onto a chart. Change the period to something other than the chart than you have open. The example in the screenshot below turns an H1 chart into an H2 chart. Set the ExtPeriodMultiplier = 2.
unnamed (1)
unnamed

Go to File \ Offline Charts. Select the new H2 period which appears in the list.

unnamed (2)

Behold, a two hour offline chart. One feature you’ll notice is that this “offline” chart actually appears to update with the price. The script is written in such a way that it feeds data through to the offline chart at regular intervals.

unnamed (3)
unnamed (4)

Some traders like to run Expert Advisors on offline charts. It works most of them time, but it adds extra potential problems. Execution will slow down due to the way the script regulates incoming ticks. The same problem, which is caused by running an infinite loop, causes the chart to stop working on rare occasions. This is where the big problems occur. An EA that no longer receives updating prices is a nightmare scenario. Trades are left naked when these events occur. There’s not much that you can do about it from a coding perspective.

4 Likes
22053 Views

You may also like

Leave A Comment

Please enter your name. Please enter an valid email address. Please enter message.