//+------------------------------------------------------------------+ //| AutoS-R.mq4 | //| zzuegg | //| when-money-makes-money.com | //+------------------------------------------------------------------+ #property copyright "zzuegg" #property link "when-money-makes-money.com" #property indicator_chart_window #property indicator_buffers 8 #property indicator_color1 Red #property indicator_color2 Red #property indicator_color3 Red #property indicator_color4 Red #property indicator_color5 Red #property indicator_color6 Red #property indicator_color7 Red #property indicator_color8 Red //---- buffers double sr1[]; double sr2[]; double sr3[]; double sr4[]; double sr5[]; double sr6[]; double sr7[]; double sr8[]; extern int period=0; extern int SR_Count=4; extern color SR_Color = Red; extern int SR_Size = 3; extern int ArrowCode=160; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_ARROW,STYLE_SOLID,SR_Size,SR_Color); SetIndexArrow(0,ArrowCode); SetIndexBuffer(0,sr1); SetIndexEmptyValue(0,0.0); SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,SR_Size,SR_Color); SetIndexArrow(1,ArrowCode); SetIndexBuffer(1,sr2); SetIndexEmptyValue(1,0.0); SetIndexStyle(2,DRAW_ARROW,STYLE_SOLID,SR_Size,SR_Color); SetIndexArrow(2,ArrowCode); SetIndexBuffer(2,sr3); SetIndexEmptyValue(2,0.0); SetIndexStyle(3,DRAW_ARROW,STYLE_SOLID,SR_Size,SR_Color); SetIndexArrow(3,ArrowCode); SetIndexBuffer(3,sr4); SetIndexEmptyValue(3,0.0); SetIndexStyle(4,DRAW_ARROW,STYLE_SOLID,SR_Size,SR_Color); SetIndexArrow(4,ArrowCode); SetIndexBuffer(4,sr5); SetIndexEmptyValue(4,0.0); SetIndexStyle(5,DRAW_ARROW,STYLE_SOLID,SR_Size,SR_Color); SetIndexArrow(5,ArrowCode); SetIndexBuffer(5,sr6); SetIndexEmptyValue(5,0.0); SetIndexStyle(6,DRAW_ARROW,STYLE_SOLID,SR_Size,SR_Color); SetIndexArrow(6,ArrowCode); SetIndexBuffer(6,sr7); SetIndexEmptyValue(6,0.0); SetIndexStyle(7,DRAW_ARROW,STYLE_SOLID,SR_Size,SR_Color); SetIndexArrow(7,ArrowCode); SetIndexBuffer(7,sr8); SetIndexEmptyValue(7,0.0); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars = IndicatorCounted(); if(counted_bars < 0) return(-1); if(counted_bars > 0) counted_bars--; int limit = Bars - counted_bars; if(counted_bars==0) limit--; //---- for(int i=limit;i>=0;i--){ double swing_value[9]={0,0,0,0,0,0,0,0,0}; int found=0; int j=iBarShift(Symbol(),period,Time[i],false); while(found<(SR_Count+1)&&j