Profile photo for Joseph Lee

Although there is a programmatic way to open a new chart using the ChartOpen(), there is no programmatic way to load an EA onto a chart.

However, the work-around will be to use the ChartApplyTemplate() function to load a pre-defined template onto a chart programmatically.

The trick to do what you want to is separated into 2 steps:
1. SETUP
— A .tpl (template) file is a text-based setting file, in which you can set the symbol, timeframe, EA, location, size, etc.
— Use a command-line script (Notepad works too), to create 100 templates (EA1.tpl, EA2.tpl, EA3.tpl, …. EA100.tpl)
— You can use an automated script to generate (a bit like mail-merging) all these 100 templates.
— Put them into the MT4\templates folder.

2. AUTOMATE LOADING

— Write a LoaderScript (or if EA, make sure it don’t repeat loading every tick!) which will do a for…loop the 100 template files.
— Use the
ChartOpen() to create a new chart, then ChartApplyTemplate() the corresponding template to it.

This way, you only need to execute the LoaderScript once and it will load up all the 100 Charts with the correct EA that you configured in the templates.

-Good luck!

View 1 other answer to this question
About · Careers · Privacy · Terms · Contact · Languages · Your Ad Choices · Press ·
© Quora, Inc. 2025