Time: 2014-10-21 | Download file:SSL_channel_chart_Histo_mtf.mq4
//+------------------------------------------------------------------+ //| SSL channel chart.mq4 | //| mladen | //| | //| initial SSL for metatrader developed by Kalenzo | //+------------------------------------------------------------------+ #property copyright "mladen" #property link "mladenfx@gmail.com" #property indicator_chart_window #property indicator_buffers 4 #property indicator_color1 Red #property indicator_color2 LawnGreen #property indicator_color3 Red #property indicator_color4 LawnGreen #property indicator_width1 2 #property indicator_width2 2 #property indicator_width3 1 #property indicator_width4 1 // // // // // extern string TimeFrame = "Current time frame"; extern int Lb = 25 ; extern int MODE_MA = 3; extern bool alertsOn = false; extern bool alertsOnCurrent = true; extern bool alertsMessage = true; extern bool alertsSound = false; extern bool alertsEmail = false; double ssld[]; double sslu[]; double ssld1[]; double sslu1[]; double Hlv[]; string indicatorFileName; bool returnBars; bool calculateValue; int timeFrame; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ // // // // // int init() { //////////////////////////// IndicatorBuffers(5); SetIndexBuffer(0,ssld); SetIndexDrawBegin(0,Lb+1);SetIndexStyle(0,DRAW_HISTOGRAM,0,2); SetIndexBuffer(1,sslu); SetIndexDrawBegin(1,Lb+1);SetIndexStyle(1,DRAW_HISTOGRAM,0,2); SetIndexBuffer(2,ssld1); SetIndexDrawBegin(2,Lb+1);SetIndexStyle(2,DRAW_LINE,0,1); SetIndexBuffer(3,sslu1); SetIndexDrawBegin(3,Lb+1);SetIndexStyle(3,DRAW_LINE,0,1); SetIndexBuffer(4,Hlv); // IndicatorBuffers(3); // SetIndexBuffer(0,ssld); SetIndexDrawBegin(0,Lb+1); // SetIndexBuffer(1,sslu); SetIndexDrawBegin(0,Lb+1); // SetIndexBuffer(2,Hlv); indicatorFileName = WindowExpertName(); returnBars = TimeFrame=="returnBars"; if (returnBars) { return(0); } timeFrame = stringToTimeFrame(TimeFrame); return(0); } // // // // // int start() { int counted_bars=IndicatorCounted(); if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; int limit=MathMin(Bars-counted_bars,Bars-1); if (returnBars) { ssld[0] = MathMin(limit+1,Bars-1); return(0); } // // // // // for(int i=limit; i>=0; i--) { int y = iBarShift(NULL,timeFrame,Time[i]); Hlv[i] = Hlv[i+1]; if(iClose(NULL,timeFrame,y)>iMA(NULL,timeFrame,Lb,0,MODE_MA,PRICE_HIGH,y+1)) Hlv[i] = 1; if(iClose(NULL,timeFrame,y)=0; i--) if (tfs==sTfTable[i] || tfs==""+iTfTable[i]) return(MathMax(iTfTable[i],Period())); return(Period()); } // // // // // string stringUpperCase(string str) { string s = str; for (int length=StringLen(str)-1; length>=0; length--) { int char = StringGetChar(s, length); if((char > 96 && char < 123) || (char > 223 && char < 256)) s = StringSetChar(s, length, char - 32); else if(char > -33 && char < 0) s = StringSetChar(s, length, char + 224); } return(s); }