Hii ALL .. can u fix my Code . i wanna make a group value from bar , so i can make indicator bar pattern ,,
MQL4:
#property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Blue #property indicator_width1 3 #property indicator_color2 Red #property indicator_width2 3 extern ENUM_TIMEFRAMES TimeFrame = PERIOD_CURRENT; extern int Shift = 0; // local variables double PipValue=1; string LF = "\n"; // use this in custom or utility blocks where you need line feeds int ObjCount = 0; // count of all objects created on the chart, allows creation of objects with unique names int current = 0; // variable points to current bar double Buffer7[]; double Buffer8[]; double bar6U; double bar12U; double bar25U; double bar50; double bar25D; double bar12D; double bar6D; int Count244 = 0; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { if (false) ObjectsDeleteAll(); // clear the chart IndicatorShortName("Indicator NAme"); IndicatorDigits(0); IndicatorBuffers(2); SetIndexBuffer(0, Buffer7); SetIndexStyle(0,DRAW_ARROW, STYLE_SOLID); SetIndexArrow(0,159); SetIndexBuffer(1, Buffer8); SetIndexStyle(1,DRAW_ARROW, STYLE_SOLID); SetIndexArrow(1,159); return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { if (false) ObjectsDeleteAll(); return(0); } //+------------------------------------------------------------------+ //| Custom indicator start function | //+------------------------------------------------------------------+ int start() { OnEveryTick1(); return(0); } //+------------------------------------------------------------------+ void OnEveryTick1() { int i; int counted_bars = IndicatorCounted(); if(counted_bars < 0) return; if(counted_bars > 0) counted_bars--; i = Bars - counted_bars; // main calculation loop while (i >= 0) { current = i; PrintMode1Sell(); bar6U = (bar12U + iMA(NULL, TimeFrame, 1,0,MODE_SMA,PRICE_HIGH,current + Shift)) /2; bar12U = (bar25U + iMA(NULL, TimeFrame, 1,0,MODE_SMA,PRICE_HIGH,current +Shift)) /2; bar25U = (bar50 + iMA(NULL, TimeFrame, 1,0,MODE_SMA,PRICE_HIGH,current +Shift)) /2; bar50 = iMA(NULL, TimeFrame, 1,0,MODE_SMA,PRICE_MEDIAN,current +Shift); bar25D = (bar50 + iMA(NULL, TimeFrame, 1,0,MODE_SMA,PRICE_LOW,current +Shift)) /2; bar12D = (bar25D + iMA(NULL, TimeFrame, 1,0,MODE_SMA,PRICE_LOW,current +Shift)) /2; bar6D = (bar12D + iMA(NULL, TimeFrame, 1,0,MODE_SMA,PRICE_LOW,current +Shift)) /2; Hammer_UP(); Hammer_DOWN(); i--; } } void PrintMode1Sell() { string temp = "Some Text\nExecuted : " + Count244 + "\n" + "---------------------------------------------------------------------------------"+"\n" + "bar6U : " + bar6U+ "\n" + "bar12U : " + bar12U+ "\n" + "bar25U : " + bar25U + "\n" + "bar50 : " + bar50 +"\n" + "bar25D : " + bar25D +"\n" + "bar12D : " + bar12D +"\n" + "bar6D : " + bar6D +"\n" + "---------------------------------------------------------------------------------"+"\n"; Comment(temp); Count244++; } void Hammer_UP() { if(Open[current + Shift] > bar25U && Close[current + Shift] > bar25U ) { BlueDotted(); } } void Hammer_DOWN() { if(Open[current + Shift] < bar25D && Close[current + Shift] < bar25D ) { RedDotted(); } } void RedDotted() { if (iFractals(NULL, TimeFrame, MODE_UPPER, current) > 0) { Buffer8[current] = iFractals(NULL, TimeFrame, MODE_UPPER, current); } else { Buffer8[current] = EMPTY_VALUE; } } void BlueDotted() { if (iFractals(NULL, TimeFrame, MODE_LOWER, current) > 0) { Buffer7[current] = iFractals(NULL, TimeFrame, MODE_LOWER, current); } else { Buffer7[current] = EMPTY_VALUE; } }