MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal

Automated Trading Language Documentation

Subscribe to signal
Forextrader649 V1
63.46%, 6 059 491.54 USD
Screenshot
EURUSD-, M15
Real
Average SpreadAverage Spread Try product
Average Spread
Author: monsterer
ATC Champions League: Interview with Olexandr Topchylo (ATC 2011) ATC Champions League: Interview with Olexandr Topchylo (ATC... StopLevelCounter Expert Advisor
StopLevelCounter
Author: GODZILLA

MqlRates

This structure stores information about the prices, volumes and spread.

struct MqlRates
  {
   datetime time;         // Period start time
   double   open;         // Open price
   double   high;         // The highest price of the period
   double   low;          // The lowest price of the period
   double   close;        // Close price
   long     tick_volume;  // Tick volume
   int      spread;       // Spread
   long     real_volume;  // Trade volume
  };

Example:

void OnStart()
  {
   MqlRates rates[];
   int copied=CopyRates(NULL,0,0,100,rates);
   if(copied<=0)
      Print("Error copying price data ",GetLastError());
   else Print("Copied ",ArraySize(rates)," bars");
  }

See also

CopyRates, Access to timeseries


Updated: 2010.08.05