//+------------------------------------------------------------------+ //| Ichimoku.mq4 | //| Copyright 2005-2014, MetaQuotes Software Corp. | //| http://www.mql4.com | //+------------------------------------------------------------------+ #property copyright "2005-2014, MetaQuotes Software Corp." #property link "http://www.mql4.com" #property description "Ichimoku Kinko Hyo" #property strict #property indicator_chart_window #property indicator_buffers 7 #property indicator_color1 clrMediumVioletRed // Tenkan-sen #property indicator_color2 clrBlue // Kijun-sen #property indicator_color3 clrDarkGreen //SandyBrown // Up Kumo #property indicator_color4 clrMaroon //Thistle // Down Kumo #property indicator_color5 clrDimGray //Lime // Chikou Span #property indicator_color6 clrLimeGreen //SandyBrown // Up Kumo bounding line #property indicator_color7 clrRed // Down Kumo bounding line //--- input parameters input int InpTenkan=9; // Tenkan-sen input int InpKijun=26; // Kijun-sen input int InpSenkou=52; // Senkou Span B //--- buffers double ExtTenkanBuffer[]; double ExtKijunBuffer[]; double ExtSpanA_Buffer[]; double ExtSpanB_Buffer[]; double ExtChikouBuffer[]; double ExtSpanA2_Buffer[]; double ExtSpanB2_Buffer[]; //--- int ExtBegin; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ void OnInit(void) { IndicatorDigits(Digits); //--- SetIndexStyle(0,DRAW_LINE,2); SetIndexBuffer(0,ExtTenkanBuffer); SetIndexDrawBegin(0,InpTenkan-1); SetIndexLabel(0,"Tenkan Sen"); //--- SetIndexStyle(1,DRAW_LINE,2); SetIndexBuffer(1,ExtKijunBuffer); SetIndexDrawBegin(1,InpKijun-1); SetIndexLabel(1,"Kijun Sen"); //--- ExtBegin=InpKijun; if(ExtBeginInpTenkan) pos=prev_calculated-1; for(i=pos; ilow[k]) low_value=low[k]; k++; } ExtTenkanBuffer[i]=(high_value+low_value)/2; } //--- Kijun Sen pos=InpKijun-1; if(prev_calculated>InpKijun) pos=prev_calculated-1; for(i=pos; ilow[k]) low_value=low[k]; k++; } ExtKijunBuffer[i]=(high_value+low_value)/2; } //--- Senkou Span A pos=ExtBegin-1; if(prev_calculated>ExtBegin) pos=prev_calculated-1; for(i=pos; iInpSenkou) pos=prev_calculated-1; for(i=pos; ilow[k]) low_value=low[k]; k++; } ExtSpanB_Buffer[i]=(high_value+low_value)/2; ExtSpanB2_Buffer[i]=ExtSpanB_Buffer[i]; } //--- Chikou Span pos=0; if(prev_calculated>1) pos=prev_calculated-1; for(i=pos; i