Import multiple custom symbol in batch

 

Hi there !

Is there a way on Metatrader to import multiple symbol (more than 100) automatically thanks to a script for example ? (I have the tick data in CSV at the moment).

Thanks for your help.

Corentin

 
Corentin:

Hi there !

Is there a way on Metatrader to import multiple symbol (more than 100) automatically thanks to a script for example ? (I have the tick data in CSV at the moment).

Thanks for your help.

Corentin

Any development on this? I'm truly interested. Have been researching on this for some days but got stuck.
 
sprigom #:
Any development on this? I'm truly interested. Have been researching on this for some days but got stuck.

https://www.mql5.com/en/code/20225

ThirdPartyTicks
ThirdPartyTicks
  • www.mql5.com
A library for working with a third-party tick archive.
 

You may use Microsoft Power Automate program to perform this. If you've Microsoft 365, you will have Power Automate along with your usual Excel, Word, Powerpoint etc. It is similar to UiPath but much more user friendly.

Download the Power Automate Desktop version. You will then need to create a flow to automate this. If you've done Object Oriented programming before, this will come in handy as it behaves very much like it (E.g. Loops, Ifs, Arrays, Variables etc..) and it involves an additional UI elements (to recognize where the buttons/windows are).

In a nutshell, this is how I've programmed my flow to import multiple CSV files into my MT5:

  1. use Action 'Get Files in Folder' and store it in Variable (Array) to get the list of CSV file names
    • your CSV file name should contain the Symbol to import and it must be a consistent naming convention
  2. launch MT5
    • either use 'launch DOS command' or
    • record UI element to click on the MT5 icon
  3. create a sub flow to loop through each of the Variable (Array) of CSV file names
    • Subflow:
      1. click on Symbol
      2. click on Import Ticks / Import Bars
      3. use Action 'Get subtext' to extract the Symbol text from the CSV file name, e.g. starting from 5th character and extract 6 characters from it and store it in a Variable
      4. Enter the Symbol and the CSV file extracted from the Array
      5. click on Import
      6. create a condition to wait for the import to complete before proceeding to the next Symbol import (I use a condition to wait until the status bar shows xxx ticks are imported in green)
      7. exit from Symbol
  4. close MT5
  5. show a message to display task is completed

Tried to import multiple CSV files into MT5 by running the flow and it works perfectly. 

Note that after recording the UI element, you need to tweak it to make Power Automate to recognize the UI element, e.g. title bar text as sometimes the Symbol itself appears in the title bar and you need to make it like "if the text Contains (rather than Equal)" in the Attribute for the ID / Title etc..

Hope this helps!

 
antaeusguy #:
Microsoft Power Automate
autohotkey is free.