HistoryDownloaderI
Download scriptThis tool functions as a data synchronization bridge between your trading chart and an external automated advisor (EA). Its primary role is to provide essential environmental information—specifically regarding the history of the price action currently visible on your screen—so that other trading tools can operate accurately based on the available data.
Core Functionality
The script automatically identifies and "broadcasts" two specific pieces of information from your trading platform to the system's memory:
- Total Bar Count: It detects exactly how many historical candles (bars) are currently loaded on your active chart.
- Starting Timestamp: It identifies the precise date and time of the very first candle available in that history.
How it Works
Instead of performing complex calculations or visual analysis, this script acts as a background information provider. Every time the platform updates:
- Data Capture: The script scans your current chart to see how much historical data is populated.
- Global Storage: It saves these two values into "Global Variables." These are permanent memory slots that allow different software components (like your main trading robot) to "see" and use this information simultaneously.
- Automatic Cleanup: To keep your platform organized, the script is programmed to automatically delete these specific memory entries as soon as you remove the indicator from the chart.
Practical Application
By using this tool, you ensure that any automated advisor you are running stays perfectly synced with your actual chart view. It prevents errors caused by "missing data" by letting the robot know exactly where your price history begins and how deep it goes.
// ++
// ¦ History Downloader Indicator HistoryDownloaderI.mq4 ¦
// ¦ Èíäèêàòîð äëÿ ñîâåòíèêà History Downloader. ¦
// ¦ Çàäà÷à äàííîãî èíäèêàòîðà - óñòàíîâêà è îáíîâëåíèå ãëîáàëüíûõ ïåðåìåííûõ: ¦
// ¦ BarOnChartCount - êîëè÷åñòâî áàðîâ íà òåêóùåì ÷àðòå; ¦
// ¦ FirstBarDateTime - äàòà è âðåìÿ ïåðâîãî áàðà íà ãðàôèêå. ¦
// ¦----------------------------------------------------------------------------------------------¦
// ¦ [release 1] 23.08.2009 ¦
// ¦ Ïåðâûé ðåëèç, áàãðåïîðòû è ïðåäëîæåíèÿ ïî îïòèìèçàöèè ïðèâåòñòâóþòñÿ ;) ¦
// ¦ | © xp3rienced, Ekaterinburg 2009 ¦
// ++
#property copyright "© xp3rienced"
#property link "no4ta[at]inbox.ru"
#property indicator_separate_window
#define GVNAME_BAR_COUNT "BarOnChartCount"
#define GVNAME_FIRST_BAR_TIME "FirstBarDateTime"
//+------------------------------------------------------------------+
//| Ôóíêöèÿ äåèíèöèàëèçàöèè èíäèêàòîðà |
//+------------------------------------------------------------------+
int deinit()
{
//----
GlobalVariableDel(GVNAME_BAR_COUNT);
GlobalVariableDel(GVNAME_FIRST_BAR_TIME);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Ôóíêöèÿ èòåðàöèè èíäèêàòîðà |
//+------------------------------------------------------------------+
int start()
{
//----
GlobalVariableSet(GVNAME_BAR_COUNT, Bars);
GlobalVariableSet(GVNAME_FIRST_BAR_TIME, Time[Bars-1]);
//----
return(0);
}
//+------------------------------------------------------------------+
Comments