//+------------------------------------------------------------------+ //| WASD_FR.mq4 | //| Copyright 2015, WASD | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2015, WASD" #property link "https://www.mql5.com" #property version "1.00" #property strict #property indicator_chart_window //--- input parameters #property indicator_color1 clrMidnightBlue #property indicator_color2 clrMidnightBlue #property indicator_buffers 2 double arr_fr_dwn[]; double arr_fr_up[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { IndicatorDigits(Digits); //--- indicator buffers mapping SetIndexBuffer(0,arr_fr_dwn); SetIndexStyle(0,DRAW_ARROW,0,1); SetIndexArrow(0,218); SetIndexLabel(0,"Fractal Down"); SetIndexBuffer(1,arr_fr_up); SetIndexStyle(1,DRAW_ARROW,0,1); SetIndexArrow(1,217); SetIndexLabel(1,"Fractal Up"); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int start() { int idx_right_bar=Bars-IndicatorCounted(); for(int i=idx_right_bar;i>0; i--) { if(IsStopped()) break; if((iLow(NULL,0,i+1)iHigh(NULL,0,i)) && (iHigh(NULL,0,i+1)>iHigh(NULL,0,i+2))) { arr_fr_up[i+1]=iHigh(NULL,0,i+1); } } return 0; } //+------------------------------------------------------------------+