//+------------------------------------------------------------------+
//|                                               Candle Changes.mq4 |
//|                                           Copyright © 2010, Ra457|
//|                                                ra457fx@gmail.com |
//+------------------------------------------------------------------+

//This indicator shows price information as comments for the most recent 5 candles.
//The left column shows the distance in price from the high to the low.
//The right column shows the distance in price from the open to the close.



#property indicator_chart_window

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
//----
double D1_R=(MathAbs(iHigh(NULL,0,1)-iLow(NULL,0,1))); //total range in price from previous candle
double D1=(MathAbs(iOpen(NULL,0,1)-iClose(NULL,0,1))); // change in price from open to close from previous candle

double D2_R=(MathAbs(iHigh(NULL,0,2)-iLow(NULL,0,2))); //total range in price from next candle back
double D2=(MathAbs(iOpen(NULL,0,2)-iClose(NULL,0,2))); //change in price from open to close from next candle back

double D3_R=(MathAbs(iHigh(NULL,0,3)-iLow(NULL,0,3)));
double D3=(MathAbs(iOpen(NULL,0,3)-iClose(NULL,0,3)));

double D4_R=(MathAbs(iHigh(NULL,0,4)-iLow(NULL,0,4)));
double D4=(MathAbs(iOpen(NULL,0,4)-iClose(NULL,0,4)));

double D5_R=(MathAbs(iHigh(NULL,0,5)-iLow(NULL,0,5)));
double D5=(MathAbs(iOpen(NULL,0,5)-iClose(NULL,0,5)));


Comment("Bar -1 Range: " + D1_R + "    Real change: " + D1 + "\nBar -2 Range: " + D2_R + "    Real change: " + D2 + "\nBar -3 Range: " + D3_R + "    Real change: " + D3 + "\nBar -4 Range: " + D4_R + "    Real change: " + D4 + "\nBar -5 Range: " + D5_R + "    Real change: " + D5);
//----
   return(0);
  }