//+------------------------------------------------------------------+ //| #MTF HA Freedom Bar.mq4 | //| Copyright © 2006, Eli hayun | //| Heiken Ashi conversion by Rupp | //| http://www.elihayun.com | //+------------------------------------------------------------------+ #property copyright "Copyright © 2006, Eli hayun" #property link "http://www.elihayun.com" #property indicator_separate_window #property indicator_minimum -0.5 //#property indicator_maximum 5 #property indicator_buffers 8 #property indicator_color1 Red #property indicator_color2 White #property indicator_color3 Red #property indicator_color4 White #property indicator_color5 Red #property indicator_color6 White #property indicator_color7 Red #property indicator_color8 White //---- buffers double buf4_up[]; double buf4_down[]; double buf3_up[]; double buf3_down[]; double buf2_up[]; double buf2_down[]; double buf1_up[]; double buf1_down[]; extern double Gap = 1; // Gap between the lines of bars extern int Period_1 = PERIOD_M5;//M15 extern int Period_2 = PERIOD_M15;//M30 extern int Period_3 = PERIOD_M30;//H1 extern int Period_4 = PERIOD_H1;//H4 //extern int cci_1 = 34;//50 //extern int cci_2 = 34;//14 //extern int cci_3 = 14; //extern int cci_4 = 14; extern bool AutoDisplay = false; string shortname = ""; bool firstTime = true; int UniqueNum = 228; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { SetAutoDisplay(); shortname = "# Forex Freedom("+Period_1+","+Period_2+","+Period_3+","+Period_4+")"; firstTime = true; IndicatorShortName(shortname); //---- indicators SetIndexStyle(0,DRAW_ARROW,0,3); SetIndexArrow(0,167); SetIndexBuffer(0,buf4_up); SetIndexEmptyValue(0,0.0); SetIndexStyle(1,DRAW_ARROW,0,3); SetIndexArrow(1,167); SetIndexBuffer(1,buf4_down); SetIndexEmptyValue(1,0.0); SetIndexStyle(2,DRAW_ARROW,0,3); SetIndexArrow(2,167); SetIndexBuffer(2,buf3_up); SetIndexEmptyValue(2,0.0); SetIndexStyle(3,DRAW_ARROW,0,3); SetIndexArrow(3,167); SetIndexBuffer(3,buf3_down); SetIndexEmptyValue(3,0.0); SetIndexStyle(4,DRAW_ARROW,0,3); SetIndexArrow(4,167); SetIndexBuffer(4,buf2_up); SetIndexEmptyValue(4,0.0); SetIndexStyle(5,DRAW_ARROW,0,3); SetIndexArrow(5,167); SetIndexBuffer(5,buf2_down); SetIndexEmptyValue(5,0.0); SetIndexStyle(6,DRAW_ARROW,0,3); SetIndexArrow(6,167); SetIndexBuffer(6,buf1_up); SetIndexEmptyValue(6,0.0); SetIndexStyle(7,DRAW_ARROW,0,3); SetIndexArrow(7,167); SetIndexBuffer(7,buf1_down); SetIndexEmptyValue(7,0.0); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- SetAutoDisplay(); shortname = "# HA Freedom("+Period_1+","+Period_2+","+Period_3+","+Period_4+")"; firstTime = true; //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); int i=0, y5m=0, y1h=0, y30m=0, y15m=0, yy; int limit=Bars-counted_bars; datetime TimeArray_1H[], TimeArray_30M[], TimeArray_15M[], TimeArray_5M[]; //---- if (firstTime || NewBar()) { firstTime = false; int win = UniqueNum; // WindowFind(shortname); double dif = Time[0] - Time[1]; for (int ii=ObjectsTotal()-1; ii>-1; ii--) { if (StringFind(ObjectName(ii),"FF_"+win+"_") >= 0) ObjectDelete(ObjectName(ii)); else ii=-1; } double shift = 0.2; for (ii=0; ii<4; ii++) { string txt = "??"; double gp; switch (ii) { case 0: txt = tf2txt(Period_1); gp = 1 + shift; break; case 1: txt = tf2txt(Period_2); gp = 1 + Gap + shift; break; case 2: txt = tf2txt(Period_3); gp = 1 + Gap*2 + shift; break; case 3: txt = tf2txt(Period_4); gp = 1 + Gap*3 + shift; break; } string name = "FF_"+win+"_"+ii+"_"+txt; ObjectCreate(name, OBJ_TEXT, WindowFind(shortname), iTime(NULL,0,0)+dif*3, gp); ObjectSetText(name, txt,8,"Arial", Silver); } } ArrayCopySeries(TimeArray_1H,MODE_TIME,Symbol(),Period_4); ArrayCopySeries(TimeArray_30M,MODE_TIME,Symbol(),Period_3); ArrayCopySeries(TimeArray_15M,MODE_TIME,Symbol(),Period_2); ArrayCopySeries(TimeArray_5M,MODE_TIME,Symbol(),Period_1); for(i=0, y5m=0, y1h=0, y30m=0, y15m=0;i