//+------------------------------------------------------------------+ //| Brooky_Psar_Levels.mq4 | //| Copyright © 2010, www.Brooky-Indicators.com. | //| http://www.www.Brooky-Indicators.com | //+------------------------------------------------------------------+ #property copyright "Copyright © 2010, www.Brooky-Indicators.com." #property link "http://www.www.Brooky-Indicators.com" extern string Hello_From = " www.Brooky-Indicators.com "; #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 DarkOrange #property indicator_color2 DodgerBlue //---- input parameters extern int bars_back = 200; extern double sar_step = 0.02; extern double sar_max = 0.2; extern int level_style = 2; extern int price_size = 2; extern color lowpsar = DodgerBlue; extern color hipsar = DarkOrange; string indi = "Brooky-Psar"; //---- buffers double plow[]; double phi[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_ARROW); SetIndexArrow(0,118); SetIndexBuffer(0,plow); SetIndexEmptyValue(0,0.0); SetIndexStyle(1,DRAW_ARROW); SetIndexArrow(1,118); SetIndexBuffer(1,phi); SetIndexEmptyValue(1,0.0); IndicatorShortName(indi); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- for(int j=0; j0) counted_bars--; limit=Bars-counted_bars; if(limit>bars_back)limit=bars_back; //---- main loop double mysarnow,myopen,mysarb4,myopenb4; for(int i=0; i=myopen && mysarb4myopenb4) { phi[i]=mysarnow; string sup = indi+"Sup"+bardelete; ObjectCreate(sup, OBJ_HLINE, 0, Time[i], mysarnow); ObjectSet(sup, OBJPROP_STYLE, level_style); ObjectSet(sup, OBJPROP_COLOR,lowpsar); ObjectSet(sup, OBJPROP_RAY,1); string nameu = indi+"aUp"+bardelete; ObjectCreate(nameu,OBJ_ARROW, 0, Time[i], mysarnow); ObjectSet(nameu, OBJPROP_STYLE, STYLE_SOLID); ObjectSet(nameu, OBJPROP_ARROWCODE, 5); ObjectSet(nameu, OBJPROP_COLOR,lowpsar); ObjectSet(nameu, OBJPROP_WIDTH,price_size); }else phi[i]=0.0; } //---- done return(0); } //+------------------------------------------------------------------+