-
If you don't have any history, here's how you can get all available from
your broker.
- Most brokers only have 32 or 65K bars of history per timeframe. That's 45 days of M1, 2.5 years on M15, etc.
- Quickly DL all available history from your broker: Problem loading historical data - MQL4 and MetaTrader 4 - MQL4 programming forum
- Programmaticly, you can get the last 2K bars via by handling
4066/4073 errors.
Download history in MQL4 EA - MQL4 and MetaTrader 4 - MQL4 programming forum
whroeder1:
Programmaticly, you can get the last 2K bars.
The last 2K bars aren't my problem. I can get that very simple.
I need to get 32K (12K or 65K, entire broker's server history ) bars of history per timeframe. I can get that manually (or programmatically by simulating keystrokes) but I'm looking for another programmatically solution.
The last 2K bars aren't my problem. I can get that very simple.
I need to get 32K (12K or 65K, entire broker's server history ) bars of history per timeframe. I can get that manually (or programmatically by simulating keystrokes) but I'm looking for another programmatically solution.
Tickstory from www.tickstory.com already does that
Tickstory from www.tickstory.com already does that
I'm looking for programmatically solution of loading entire history for a symbol and a timeframe from server. I can do it manually by opening a chart with the required symbol and the required timeframe and then (unlock Scroll the chart button) by pressing Home and multiple pressing PgUp until I get to the oldest bar in the server history. But I need doing this by code (in the best way without opening the chart). Of course I can do it by programmatically opening the chart and simulating the keystrokes by API and then close the chart in the end. I was wondering if there is any easier solution? It may not be easier, but without opening and closing the chart and without API. Any Idea?
You need to open the chart in all cases. If by API you mean WinAPI you don't need that, it can be done without it, using ChartNavigate().
You need to open the chart in all cases. If by API you mean WinAPI you don't need that, it can be done without it, using ChartNavigate().
Thank you Alain,
as usual, is your contribution to the matter. I'll try that and write the result here.
void updatehist(string sym, ENUM_TIMEFRAMES tf) { long id = ChartOpen(sym, tf); Sleep(1000); ChartRedraw(id); Sleep(200); ChartSetInteger(id, CHART_AUTOSCROLL, false); datetime oldest_serv = (datetime)SeriesInfoInteger(sym, tf, SERIES_SERVER_FIRSTDATE); while(ChartGetInteger(id, CHART_AUTOSCROLL) == true) Sleep(100); datetime current = iTime(sym, tf, iBars(sym, tf) - 1); LabelCreate(id, "txt1", 0, 10, 40, CORNER_LEFT_UPPER, "Loading history.. Please wait..", "Consolas", 28, clrTurquoise); LabelCreate(id, "txt2", 0, 10, 80, CORNER_LEFT_UPPER, "Current " + (string) current + " of " + (string)oldest_serv, "Consolas", 28, clrTurquoise); while((int)oldest_serv < (int)current && !IsStopped()) { ChartRedraw(id); RefreshRates(); ObjectSetString(id, "txt2", OBJPROP_TEXT, "Current " + (string) current + " of " + (string)oldest_serv); ChartNavigate(id, CHART_CURRENT_POS, -1000); Sleep(100); current = iTime(sym, tf, iBars(sym, tf) - 1); } ChartClose(id); }
This should work well.. LabelCreate() functions from MQL4 help
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I'm looking for programmatically solution of loading entire history for a symbol and a timeframe from server. I can do it manually by opening a chart with the required symbol and the required timeframe and then (unlock Scroll the chart button) by pressing Home and multiple pressing PgUp until I get to the oldest bar in the server history. But I need doing this by code (in the best way without opening the chart). Of course I can do it by programmatically opening the chart and simulating the keystrokes by API and then close the chart in the end. I was wondering if there is any easier solution? It may not be easier, but without opening and closing the chart and without API. Any Idea?