//+--------------------------------------------------------------------------------------------------+ //| b_Kaufman_Volatility.mq5 | //| Copyright © 2011, barmenteros | //| http://www.mql4.com/users/barmenteros | //+--------------------------------------------------------------------------------------------------+ #property copyright "Copyright © 2011, barmenteros" #property link "barmenteros.fx@gmail.com" #property version "1.00" #property description "Kaufman Volatility according to Perry Kaufman books \"Smarter Trading\"." //--- indicator settings #property indicator_separate_window #property indicator_buffers 1 #property indicator_plots 1 #property indicator_color1 clrRed #property indicator_label1 "Kaufman Volatility" //+--------------------------------------------------------------------------------------------------+ //| Enumerations | //+--------------------------------------------------------------------------------------------------+ enum his_switch { On, Off }; //--- input parameters input uchar ERperiod=10; // Efficiency ratio period input his_switch histogram=Off; // Histogram switch input char shift=0; // Horizontal shift (in bars) //--- indicator buffers double KVBfr[]; //+--------------------------------------------------------------------------------------------------+ //| Volatility | //+--------------------------------------------------------------------------------------------------+ double Volatility(int initialbar, int period, const double &price[]) { int j; double v=0.0; for(j=0; j