Run a macro with an existing scrip

To add comments, please log in or register
Dave Richards
40
Dave Richards  

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...
Carl Schreiber
Moderator
7142
Carl Schreiber  

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)

Dave Richards
40
Dave Richards  

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

nicholi shen
1922
nicholi shen  
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. 
Dave Richards
40
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?
nicholi shen
1922
nicholi shen  
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));
}
Dave Richards
40
Dave Richards  
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!)
Dave Richards
40
Dave Richards  
I wonder if anyone has seen a script which does full data export in CSV?
Dave Richards
40
Dave Richards  
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...
To add comments, please log in or register