Screwed results from simple mean of candle size?

 

Hi everyone, I've basically created a script that will report the average High/Low range for the Symbol and TF considered, it will calculate every single candle, as you see:

//+------------------------------------------------------------------+
//|                                             Avg Hourly range.mq4 |
//|                                                         |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "ui"
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
#property show_inputs
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
   
   double total_pips=0;   
   
   for(int i=1;i<Bars;i++)
     {
      total_pips = total_pips+(iHigh(Symbol(),0,i) - iLow(Symbol(),0,i));
     }
   
     
   Alert("");
   Alert("");
   Alert("");
 
   Alert("Analyzed ",Bars," candles");  
   Alert("Avg. pips from High to Low on this TF: ",NormalizeDouble(total_pips/(Bars),5));
 
  }
//+------------------------------------------------------------------+

The problem is that if I run this script on GBPUSD m30 it will give me an average of 14pips, but if I run it on H1 it will give ~19pips... How is this possible? H1 is the sum of two m30 candles, so logically it should be 28pips. Am I wrong? Can someone explain? Thank's. 

 
ironhak:

Hi everyone, I've basically created a script that will report the average High/Low range for the Symbol and TF considered, it will calculate every single candle, as you see:

The problem is that if I run this script on GBPUSD m30 it will give me an average of 14pips, but if I run it on H1 it will give ~19pips... How is this possible? H1 is the sum of two m30 candles, so logically it should be 28pips. Am I wrong? Can someone explain? Thank's. 

You are wrong!

I am sure that you will find plenty of times that the second M30 candle in any hour does not create a higher high or lower low than the first M30 candle. In such case the range for the H1 candle will be the same as the first M30 candle.

 
Keith Watford #:

You are wrong!

I am sure that you will find plenty of times that the second M30 candle in any hour does not create a higher high or lower low than the first M30 candle. In such case the range for the H1 candle will be the same as the first M30 candle.

Yes, I agree with you. I also thought about this but I concluded that in the long run price should "balance" itself and eventually make every average candle the sum of its parts... But there's always a little discrepancy as I see. Thank's. 

 
ironhak #:

Yes, I agree with you. I also thought about this but I concluded that in the long run price should "balance" itself and eventually make every average candle the sum of its parts... But there's always a little discrepancy as I see. Thank's. 

Why would you think that it should "balance" itself??

By your reasoning it should also  "balance" itself with M1 and D1 average range.

A reasonable average range on M1 mat be 1 pip, so you would think that the average on D! should be about 1*1440.

How many days' ranges are anywhere near 1440 pips? Very few (if any), and there would be much more than a minor discrepancy!

Reason: