Navigation:Home > Content >

Test_of_History_file.mq4

Time: 2012-12-25 | Download file:Test_of_History_file.mq4

//+------------------------------------------------------------------+
//|                                         Test of History file.mq4 |
//|                                   Copyright © 2008, Serega Lykov |
//|                                       http://mtexperts.narod.ru/ |
//+------------------------------------------------------------------+

#property copyright "Copyright © 2008, Serega Lykov"
#property link      "http://mtexperts.narod.ru/"

extern string   symbol = "GBPUSD";
static datetime bartime;

//+------------------------------------------------------------------+
//| Iteration function                                               |
//+------------------------------------------------------------------+
int start()
  {
   datetime time = iTime(symbol,PERIOD_M1,0);
   if(bartime == time) return(0);
   bartime = time;
   Print("--------------------------------------- ",TimeToStr(bartime), " ---------------------------------------");
   for(int i=0; i<5; i++)
     {
      double open  = NormalizeDouble(iOpen(symbol,PERIOD_M1,i),Digits);
      double high  = NormalizeDouble(iHigh(symbol,PERIOD_M1,i),Digits);
      double low   = NormalizeDouble(iLow(symbol,PERIOD_M1,i),Digits);
      double close = NormalizeDouble(iClose(symbol,PERIOD_M1,i),Digits);
      int volume = iVolume(symbol,PERIOD_M1,i);
      time = iTime(symbol,PERIOD_M1,i);
      Print("shift = ",i," : Time = ",TimeToStr(time),", Open = ",open,", High = ",high,", Low = ",low,", Close = ",close,", Volume = ",volume);
     }
   return(0);
  }

//+------------------------------------------------------------------+

Recommend