//+------------------------------------------------------------------+ //| MPCandle.mq4 | //| Copyright ?2013, Walter Choy | //| brother3th@yahoo.com | //+------------------------------------------------------------------+ #property copyright "Copyright ?2013, Walter Choy" #property link "brother3th@yahoo.com" #property indicator_chart_window #property indicator_buffers 1 #property indicator_color1 Yellow #property indicator_width1 2 //--- parameters extern string desc = "(Base on PERIOD values, must be smaller than the chart time frame) base_period = 1, 5, 15, 30, 60, 240...etc."; extern int base_period = 1; //set base_period to 1 is best for M5 and M15; set to 5 is best for H4 and D1 extern int max_counting_bars = 250; extern bool show_static = true; extern int static_show_n = 250; extern color static_txt_color = Black; //--- buffers double FocusBuffer[]; double tempBuffer[500][2]; double staticBuffer[]; int idx = 0; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators IndicatorBuffers(2); IndicatorDigits(Digits); SetIndexStyle(0,DRAW_ARROW); SetIndexArrow(0,159); SetIndexBuffer(0,FocusBuffer); SetIndexEmptyValue(0,0.0); SetIndexStyle(1, DRAW_NONE); SetIndexBuffer(1, staticBuffer); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- for (int n=0; n max_counting_bars) i = max_counting_bars; double interval = Period() / base_period; while(i >= 0){ // Clear tempBuffer ArrayInitialize(tempBuffer, 0); //for (j=0; j<=idx; j++){ // tempBuffer[j][0] = 0; // tempBuffer[j][1] = 0; //} // For each trade period, counting the occurrence idx = 0; for(j=0; j= Time[i]+j*base_period*60){ double cp = NormalizeDouble(iClose(NULL, base_period, iBarShift(NULL, base_period, Time[i]+j*base_period*60)), Digits - 1); for(k=0; k