//+------------------------------------------------------------------+ //| TradeForexFx | //| | //+------------------------------------------------------------------+ /* +------------------------------------------------------------------+ +------------------------------------------------------------------+ */ #property indicator_minimum 0.0 #property indicator_maximum 1.5 #property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 Blue #property indicator_width1 3 #property indicator_color2 Red #property indicator_width2 3 //---- IndicatorShortName ("Candle Helper"); IndicatorDigits (0); extern int CandleHeight = 2; extern int CandleBody = 0; double CrossUp[]; double CrossDown[]; //int Mode = 1; //extern int TimeFrame = 0; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0, DRAW_HISTOGRAM, EMPTY, 4); SetIndexBuffer(0, CrossUp); SetIndexStyle(1, DRAW_HISTOGRAM, EMPTY, 4); SetIndexBuffer(1, CrossDown); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int limit, i, counter; int counted_bars=IndicatorCounted(); //---- check for possible errors if(counted_bars<0) return(-1); //---- last counted bar will be recounted if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; for(i = 0; i <= limit; i++) { counter=i; for (counter=i ;counter<=i+9;counter++) if ( MathAbs(iClose(NULL,0,i) - iOpen(NULL,0,i)) >= Point * CandleBody && MathAbs(iHigh(NULL,0,i) - iLow(NULL,0,i)) >= Point * CandleHeight && iClose(NULL,0,i) > iOpen(NULL,0,i) ) { CrossUp[i] = 1; } else if ( MathAbs(iClose(NULL,0,i) - iOpen(NULL,0,i)) >= Point * CandleBody && MathAbs(iHigh(NULL,0,i) - iLow(NULL,0,i)) >= Point * CandleHeight && iClose(NULL,0,i) < iOpen(NULL,0,i) ) { CrossDown[i] = 1; } } return(0); }