How to create an EA from chart objects?

8 October 2024

Indicators are quite often created for manual trading, unfortunately not taking into account automation needs. For automation, the developer of the indicator is supposed to make sure that all the relevant values are available, using the so called 'buffers'. However, if the developer didn't have automation in mind, you may find that the buffers are missing and you only have objects on the chart.

We're excited to offer you a solution to this problem—available as a free bonus exclusively for our subscribers.

The Object to Buffer solution

Create EA from indicator with objects
Duration: 3 minutes 53 seconds

The problem with indicators without buffers explained

A well-designed indicator calculates values, such as arrows and areas, and stores those values in buffers. The indicator then instructs MetaTrader to display these objects on the chart.

normal indicator
Normal indicator.

The advantage of using buffers is that, in addition to MetaTrader displaying the objects on the chart, an Expert Advisor (EA) can access these values and use them to make trading decisions. If your indicator has buffers, or if you're unsure whether it does, please check our Create an EA Using a (Custom) Indicator page.

normal indicator automation
Normal indicator automation.

However, when buffers are missing and the indicator directly paints objects on the chart, MetaTrader's buffer system is bypassed. As a result, the EA cannot read the indicator's values, limiting automation capabilities.

broken indicator automation
Broken indicator automation.

Our solution to indicators without buffers

Our Objects to Buffer indicator scans the chart and puts the relevant values into buffers. Once these values are in the buffers, your EA can read them and make trading decisions.

object to buffer solution
Solution with Object to Buffer.

Our Objects to Buffer indicator has 2 main features:

  • Object name/ Object description (or part of): Search for objects by name, description, or both. You can enter the full name/description or just a unique part you're interested in.
  • Put the last matching object on Shift 0: You can either find the object for each bar and add its value to the corresponding bar, or find the most recent matching object (based on your search filter) and apply its value to the current bar (Shift 0).
The indicator includes an optional setting to enter the name of an indicator. If you enter a name, the Objects to Buffer indicator will call that indicator with its default settings. If you prefer not to use the default settings, leave this field empty. In that case, manually add the indicator to the chart and adjust the settings as needed. The Objects to Buffer indicator will still read the chart objects.

object to buffer settings
Settings of the Object to Buffer indicator with the 'Rectangle' filter, as is the object is partly named on the chart.

Once the indicator is added to the chart, you should see the values of the chart objects in the Data Window (CTRL + D). If you can see the values there, the indicator is properly configured, and you can add it to your EA as you normally would when using custom indicators. Keep in mind that you'll need to upload and add the Objects to Buffer indicator to your EA instead of the original indicator that adds objects to the chart.

object to buffer result
Result of Object to Buffer indicator (data in buffers).

How to get the Objects to Buffer indicator?

If you're subscribed, you can download the indicator here (MT4 | MT5).