Run a macro with an existing scrip

 

I have a neatly working scrip which exports the data when I attach to a single chart.


Can this script be run by a macro which will progressively attach it to all of the open charts - automatically? just run through all open charts...
the scrip is here
https://www.mql5.com/en/code/232

Dave

YURAZ_CreateCSV_HistoryFile_From_MT5_For_MT4
YURAZ_CreateCSV_HistoryFile_From_MT5_For_MT4
  • www.mql5.com
When I used the history quotes data from MetaTrader4 client terminal, I have found that some brokers doesn't have the full history. The quality of the historical bar data is better, so I have decided to export the historical quotes from MetaTrader 5 and import them in MetaTrader 4. This script will help you to get the full history for...
 

You can build a loop with:

ChartID

ChartIndicatorsTotal

ChartFirst

ChartNext

ChartNavigate

and before that a loop though all Symbols and open a chart with them with:

ChartOpen

You find them all in the MQL5 reference (some with examples)

 

thanks a lot Carl!!

can you show me an example of such loop?


or - beteer yet - BEIGN A MDOERATOR - maybe - you have a seen a script which just exports all open charts in CSV format? without the needt to attach and loop through all open charts???

thansk alot!!!

dave

 
You don't actually need to open the charts for this to work on other symbols. You just need to convert the existing OnStart handler to a func that accepts a string params (symbol) and then iterate over a list of symbols calling your new func. 
 
that sounds gerat but I am new to coding - maybe you have seen a script which does this? I think this woudl be a very handy macro for all -c an you help me code this?
 
Dave Richards:
that sounds gerat but I am new to coding - maybe you have seen a script which does this? I think this woudl be a very handy macro for all -c an you help me code this?

It depends on what symbols you need. This is a snippet to get the symbols which are active in the market watch window. 


void OnStart()
{
   for(int i=SymbolsTotal(true)-1; i>=0; --i)
      do_history_stuff(SymbolName(i, true));
}
 
Thank you - do you think you can help me write this code - or maybe you can help me find a script which does this - export all open charts - I am amazed that noone has not yet cerated such a script - we could be the first!)
 
I wonder if anyone has seen a script which does full data export in CSV?
 
nicholi shen:

It depends on what symbols you need. This is a snippet to get the symbols which are active in the market watch window. 


thanks a lot - how do I modify this script to apply that indicator (YURAZ_CreateCSV_HistoryFile_From_MT5_For_MT4)?
YURAZ_CreateCSV_HistoryFile_From_MT5_For_MT4
YURAZ_CreateCSV_HistoryFile_From_MT5_For_MT4
  • www.mql5.com
When I used the history quotes data from MetaTrader4 client terminal, I have found that some brokers doesn't have the full history. The quality of the historical bar data is better, so I have decided to export the historical quotes from MetaTrader 5 and import them in MetaTrader 4. This script will help you to get the full history for...
Reason: