//+------------------------------------------------------------------+
//|                                     Volume and Range display.mq4 |
//|                                                    Steve Hopwood |
//|                                     www.hopwood3.freeserve.co.uk |
//+------------------------------------------------------------------+
#property copyright "Steve Hopwood"
#property link      "www.hopwood3,freeserve.co.uk"
#include <WinUser32.mqh>
#include <stdlib.mqh>
#define  NL    "\n"

string            Gap;
int               DisplayGapSize=30;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----

   Gap="";
   if (DisplayGapSize >0)
   {
      for (int cc=0; cc< DisplayGapSize; cc++)
      {
         Gap = StringConcatenate(Gap, " ");
      }   
   }
   
   start();
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
   double PreviousRange = (iHigh(NULL,0,1) - iLow(NULL,0,1));
  
   //Checking sufficiently wide trading range
   // Remember to check code that deals with 6 digit brokers
   int Multiplier;
   if (Digits == 6) Multiplier = 100000; //6 digits
   else if (Digits == 3) Multiplier = 1000;   
   else if (Digits == 2) Multiplier = 100;  
   else Multiplier = 10000; //Normal
   PreviousRange = PreviousRange * Multiplier;
   
   double PreviousVolume = iVolume(NULL,0,1);
   double CurrentVolume = iVolume(NULL,0,0);
   string ScreenMessage;
   
   ScreenMessage = StringConcatenate(ScreenMessage, Gap, "Previous Range = ", PreviousRange,NL);
   ScreenMessage = StringConcatenate(ScreenMessage, Gap, "Previous Volume = ", PreviousVolume,NL);
   ScreenMessage = StringConcatenate(ScreenMessage, Gap, "Current Volume = ", CurrentVolume,NL);
   
   
   Comment(ScreenMessage);
   
//----
   return(0);
  }
//+------------------------------------------------------------------+