//+------------------------------------------------------------------+ //| | //| Copyright © 2004, MetaQuotes Software Corp. | //| http://www.metaquotes.net/ | //+------------------------------------------------------------------+ #property copyright "Copyright © December 2006, FX Sniper " #property link "http://www.metaquotes.net/" //---- indicator settings #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Lime #property indicator_color2 Red //---- buffers double sar1[]; double sar2[]; extern double Step = 0.02; extern double Maximum = 0.2; int shift; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- 2 additional buffers are used for counting. IndicatorBuffers(8); //---- drawing settings SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2); SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2); SetIndexBuffer(0,sar1); SetIndexBuffer(1,sar2); //---- initialization done return(0); } int start() { for(shift=Bars;shift>=0;shift--) { double sar=iSAR(NULL,0,Step,Maximum,shift); if (Low[shift] >= sar) { sar1[shift] = EMPTY_VALUE; sar2[shift] = sar; } else { sar2[shift] = EMPTY_VALUE; sar1[shift+1] = sar; } } return(0); }