//+------------------------------------------------------------------+ //| CANAL.mq4 | //| Copyright 2013, MetaQuotes Software Corp. | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "Copyright 2013, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" #property indicator_chart_window #property indicator_buffers 5 #property indicator_color1 Red #property indicator_color2 DeepPink #property indicator_color3 Blue #property indicator_color4 DodgerBlue #property indicator_color5 Gold //--- input parameters extern int per1=12; //--- buffers double HBuffer[]; double HBuffer1[]; double LBuffer[]; double LBuffer1[]; double SBuffer[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_SECTION); SetIndexBuffer(0,HBuffer); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,HBuffer1); SetIndexStyle(2,DRAW_SECTION); SetIndexBuffer(2,LBuffer); SetIndexStyle(3,DRAW_LINE); SetIndexBuffer(3,LBuffer1); SetIndexStyle(4,DRAW_LINE); SetIndexBuffer(4,SBuffer); IndicatorShortName("CANAL"); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int Counted_bars=IndicatorCounted(); double History=500; int i=Bars-Counted_bars-1; if (i>History-1) i=History-1; while(i>=0) { HBuffer[i]=High[iHighest(NULL,0,MODE_HIGH,per1,i)]; LBuffer[i]=Low[iLowest(NULL,0,MODE_LOW,per1,i)]; HBuffer1[i]=Low[iHighest(NULL,0,MODE_LOW,per1,i)]; LBuffer1[i]=High[iLowest(NULL,0,MODE_HIGH,per1,i)]; SBuffer[i]=(High[i]+Low[i]+Open[i])/3; i--; } //---- //---- return(0); } //+------------------------------------------------------------------+