//+------------------------------------------------------------------+
//|                                                       CRates.mq4 |
//|                                                      nicholishen |
//|                                   www.reddit.com/u/nicholishenFX |
//+------------------------------------------------------------------+
#property copyright "nicholishen"
#property link      "www.reddit.com/u/nicholishenFX"
#property version   "1.00"
#property strict
#include <Rates.mqh>

void OnStart()
{
   int lookback_candle=200, start_candle = 0;
   CRates rates(Symbol(),PERIOD_M1);
   rates.CopyRates(start_candle,lookback_candle);
   int h = rates.HighestHigh();
   int l = rates.LowestLow();
   double range = rates.High(h) - rates.Low(l);
   int t1 = int(rates.Time(h));
   int t2 = int(rates.Time(l));
   int elapsed = t1 > t2 ? (t1 - t2) / 60 : (t2 - t1) / 60;
   Print("The range is ",DoubleToStr(range,Digits)," with an elapsed time of ",elapsed," minutes.");
   
   
}

