Price Data Collector

Download script
Author: Copyright � 2008, Todd Geiger, fxid10t@yahoo.com (tageiger@comcast.net)
Price Data Collector

This tool is designed as an automated data gathering utility for traders who need to monitor multiple currency pairs and timeframes simultaneously. Instead of a user manually switching between different charts to see how various assets are performing, this script systematically cycles through a predefined list of popular forex pairs and several specific time intervals (such as 1-minute, 5-minute, 15-minute, 30-minute, and 60-minute periods).

How the Logic Works

Sequential Scanning The core functionality operates on a rotation system. Every time the script executes, it moves to the next currency pair in its internal list (for example, moving from EURUSD to USDJPY). It then performs a full sweep of all the timeframes it is programmed to track for that specific pair.

Data Extraction For every combination of pair and timeframe, the script captures four vital pieces of price information:

  • The opening price
  • The highest price reached
  • The lowest price reached
  • The closing price

Smart Adjustments The script includes a specialized check to ensure compatibility with different types of trading accounts. If it detects a non-standard symbol format (often seen in specific "mini" account types), it automatically adjusts the naming convention to ensure it correctly identifies the correct market data.

Dynamic Environment Handling If the tool is used in a "testing" or "backtesting" environment—where traders simulate past trading history—the script intelligently overrides its default list. Instead of cycling through its standard presets, it focuses exclusively on the specific pair and timeframe currently being tested by the user.

In essence, this script acts as an automated "scout." It methodically travels through every market combination in your list, pulling the most recent price action for each, making it a foundation for any strategy that relies on broad-market data collection.

Price Data Components
Series array that contains open prices of each barSeries array that contains the highest prices of each barSeries array that contains the lowest prices of each barSeries array that contains close prices for each bar
9 Views
0 Downloads
0 Favorites
Price Data Collector
//+------------------------------------------------------------------+
//| Price Data Collector.mq4
//| Copyright © 2008, Todd Geiger, fxid10t@yahoo.com (tageiger@comcast.net)
//| http://www.metaquotes.net
/*+------------------------------------------------------------------+

This indicator is intended to collect price data for various pairs and various
chart time periods.    */

#property copyright "Copyright © 2008, Todd Geiger, fxid10t@yahoo.com (tageiger@comcast.net)"
#property link      "http://www.metaquotes.net"

#property indicator_chart_window
#include <stdlib.mqh>

string pairs[] = { "EURUSD","USDJPY","GBPUSD","USDCHF","EURCHF","AUDUSD","USDCAD",
                   "NZDUSD","EURGBP","EURJPY","GBPJPY","CHFJPY","GBPCHF","EURAUD",
                   "EURCAD","AUDCAD","AUDJPY","NZDJPY","AUDNZD" };

int periods[] = { 1,5,15,30,60 };

string   TradeSymbol;
int      TradePeriod;
int      Pair = -1;
int      PPeriod = -1;
double   o,h,l,c;

int init(){
   if ( IsTesting() ) { if ( ArrayResize(pairs,1) != 0 )  pairs[0] = Symbol();   } 
   if ( IsTesting() ) { if ( ArrayResize(periods,1) != 0 )  periods[0] = Period(); }

return(0);  }

int deinit(){return(0);}

int start(){
//Select Pair from Array
Pair = (Pair+1) % ArraySize(pairs);
TradeSymbol = pairs[Pair];
if(StringLen(Symbol())!=6) {
   TradeSymbol=TradeSymbol+StringSubstr(Symbol(),6,1);   }//for ibfx mini accounts

//Pair Chart Period price data loop
for(int p=0; p<ArraySize(periods); p++) {
      PPeriod = (PPeriod+1) % ArraySize(periods);
      TradePeriod = periods[PPeriod];
      o=iOpen(TradeSymbol,TradePeriod,0);
      h=iHigh(TradeSymbol,TradePeriod,0);
      l=iLow(TradeSymbol,TradePeriod,0);
      c=iClose(TradeSymbol,TradePeriod,0);   }
return(0);  }
//+------------------------------------------------------------------+

Comments