//+--------------------------------------+ //+ ----=== maloma`s`channel ===---- + //+--------------------------------------+ #property copyright "Copyright © 2006, maloma" #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Red #property indicator_color2 Blue //---- input parameters //---- buffers double dUpChannelBuffer[]; double dDownChannelBuffer[]; double HiPrice=0; double LoPrice=0; double CurHiPrice=0; double CurLoPrice=0; int otstup=0; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicator buffers mapping SetIndexBuffer(0,dUpChannelBuffer); SetIndexBuffer(1,dDownChannelBuffer); //---- drawing settings SetIndexStyle(0,DRAW_LINE); SetIndexArrow(0,119); SetIndexStyle(1,DRAW_LINE); SetIndexArrow(1,119); //---- SetIndexEmptyValue(0,0.0); SetIndexEmptyValue(1,0.0); //---- name for DataWindow SetIndexLabel(0,"Channel Up"); SetIndexLabel(1,"Channel Down"); //---- initialization done return(0); } //+------------------------------------------------------------------+ //| Custor indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- TODO: add your code here //---- return(0); } int start() { int i,nCountedBars; nCountedBars=IndicatorCounted(); //---- check for possible errors if(nCountedBars<0) return(-1); //---- last counted bar will be recounted if(nCountedBars<=2) i=Bars-nCountedBars-3; if(nCountedBars>2) { nCountedBars--; i=Bars-nCountedBars-1; } while(i>=2) { //----Up and Down Fractals //----5 bars Fractal if(High[i]>High[i+1] && High[i]>High[i+2] && High[i]>High[i-1] && High[i]>High[i-2]) { HiPrice= High[i]+otstup*Point; dUpChannelBuffer[i-3]= HiPrice; } else dUpChannelBuffer[i-3]= HiPrice; if(Low[i]=3) { if(High[i]==High[i+1] && High[i]>High[i+2] && High[i]>High[i+3] && High[i]>High[i-1] && High[i]>High[i-2]) { HiPrice= High[i]+otstup*Point; dUpChannelBuffer[i-3]= HiPrice; } else dUpChannelBuffer[i-3]= HiPrice; if(Low[i]==Low[i+1] && Low[i]=4) { if(High[i]>=High[i+1] && High[i]==High[i+2] && High[i]>High[i+3] && High[i]>High[i+4] && High[i]>High[i-1] && High[i]>High[i-2]) { HiPrice= High[i]+otstup*Point; dUpChannelBuffer[i-3]= HiPrice; } else dUpChannelBuffer[i-3]= HiPrice; if(Low[i]<=Low[i+1] && Low[i]==Low[i+2] && Low[i]=5) { if(High[i]>=High[i+1] && High[i]==High[i+2] && High[i]==High[i+3] && High[i]>High[i+4] && High[i]>High[i+5] && High[i]>High[i-1] && High[i]>High[i-2]) { HiPrice= High[i]+otstup*Point; dUpChannelBuffer[i-3]= HiPrice; } else dUpChannelBuffer[i-3]= HiPrice; if(Low[i]<=Low[i+1] && Low[i]==Low[i+2] && Low[i]==Low[i+3] && Low[i]=6) { if(High[i]>=High[i+1] && High[i]==High[i+2] && High[i]>=High[i+3] && High[i]==High[i+4] && High[i]>High[i+5] && High[i]>High[i+6] && High[i]>High[i-1] && High[i]>High[i-2]) { HiPrice= High[i]+otstup*Point; dUpChannelBuffer[i-3]= HiPrice; } else dUpChannelBuffer[i-3]= HiPrice; if(Low[i]<=Low[i+1] && Low[i]==Low[i+2] && Low[i]<=Low[i+3] && Low[i]==Low[i+4] && Low[i]