//+------------------------------------------------------------------+ //| MT4_DASHBOARD_V1.5.mq4 | //| Copyright © 2008, "OTCFX" | //| Revision 1.5 | //| *Credits to"mladen" | //| for some bits&pieces. | //+------------------------------------------------------------------+ #property copyright "Copyright © 2008 OTCFX" #property indicator_separate_window #property indicator_buffers 0 #property indicator_minimum 0 #property indicator_maximum 1 extern string _ = "PAIRS"; extern string pairs = "EURUSD;GBPUSD;AUDUSD;USDCHF;USDCAD;USDJPY;GBPJPY;EURJPY;GBPCHF;EURAUD;EURCHF;EURGBP"; string timeFrames = "M5;M15;M30;H1;H4;D1;W1"; extern color ColorUp = LimeGreen; extern color ColorNeutral = Gray ; extern color ColorDown = Red ; extern color ValueColor = DodgerBlue; extern int ValueSize = 10; extern string ValueFont= "Verdana"; extern int FastMAPeriod = 10 ; extern int SlowMAPeriod = 15 ; extern int MAType = 1 ; extern int RSI_Period = 14 ; extern int RSI_Type = 0; extern bool show.RSI = true ; extern bool show.MA = false ; extern bool show.CANDLE = false ; extern bool show.SCORE = true ; int window; int totalPairs; int totalTimeFrames; int totalLabels; int aTimes[]; string aPairs[]; string sTimes[]; color ColorLabels = White; color MA_color; color srsi_color; color cad_color; string MA_arrow; string srsi_arrow; string cad_arrow; string labelNames; string shortName; int corner; int INC_UP ; int INC_UC ; int INC_DN; int MAMode; int PRMode; int RSIMode; string strMAType; string strRSIType; bool ShowCount = true; extern string __ = "Lable&Calc!"; extern string Pair0 = "EURUSD"; extern string Pair1 = "GBPUSD"; extern string Pair2 = "AUDUSD"; extern string Pair3 = "USDCHF"; extern string Pair4 = "USDCAD"; extern string Pair5 = "USDJPY"; extern string Pair6 = "GBPJPY"; extern string Pair7 = "EURJPY"; extern string Pair8 = "GBPCHF"; extern string Pair9 = "EURAUD"; extern string Pair10 = "EURCHF"; extern string Pair11 = "EURGBP"; extern string Pair12 = "" ; extern string Pair13 = "" ; extern string Pair14 = "" ; extern string Pair15 = "" ; extern string Pair16 = "" ; extern string Pair17 = "" ; extern string Pair18 = "" ; extern string Pair19 = "" ; extern string Pair20 = "" ; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { switch (MAType) { case 1: strMAType="EMA"; MAMode=MODE_EMA; break; case 2: strMAType="SMMA"; MAMode=MODE_SMMA; break; case 3: strMAType="LWMA"; MAMode=MODE_LWMA; break; case 4: strMAType="LSMA"; break; default: strMAType="SMA"; MAMode=MODE_SMA; break; } switch (RSI_Type) { case 1: strRSIType="OPEN"; PRMode=PRICE_OPEN; break; case 2: strRSIType="HIGH"; PRMode=PRICE_HIGH; break; case 3: strRSIType="LOW"; PRMode=PRICE_LOW; break; case 4: strRSIType="MEDIAN"; PRMode=PRICE_MEDIAN; break; case 5: strRSIType="TYPICAL"; PRMode=PRICE_TYPICAL; break; case 6: strRSIType="WEIGHTED"; PRMode=PRICE_WEIGHTED; break; default: strRSIType="CLOSE"; PRMode=PRICE_CLOSE; break; } corner = 0; shortName = MakeUniqueName("MT4_DB ",""); labelNames = shortName; IndicatorShortName(shortName); pairs = StringUpperCase(StringTrimLeft(StringTrimRight(pairs))); if (StringSubstr(pairs,StringLen(pairs),1) != ";") pairs = StringConcatenate(pairs,";"); bool isMini = IsMini(); int s = 0; int i = StringFind(pairs,";",s); int time; string current; string temp; while (i > 0) { current = StringSubstr(pairs,s,i-s); if (isMini) current = StringConcatenate(current,"m"); time = stringToTimeFrame(current); current = StringSubstr(pairs,s,i-s); if (isMini) current = StringConcatenate(current,"m"); if (iClose(current,0,0) > 0) { ArrayResize(aPairs,ArraySize(aPairs)+1); aPairs[ArraySize(aPairs)-1] = current; } s = i + 1; i = StringFind(pairs,";",s); } timeFrames = StringUpperCase(StringTrimLeft(StringTrimRight(timeFrames))); if (StringSubstr(timeFrames,StringLen(timeFrames),1) != ";") timeFrames = StringConcatenate(timeFrames,";"); s = 0; i = StringFind(timeFrames,";",s); //int time; while (i > 0) { current = StringSubstr(timeFrames,s,i-s); time = stringToTimeFrame(current); if (time > 0) { ArrayResize(sTimes,ArraySize(sTimes)+1); ArrayResize(aTimes,ArraySize(aTimes)+1); sTimes[ArraySize(sTimes)-1] = TimeFrameToString(time); aTimes[ArraySize(aTimes)-1] = time; } s = i + 1; i = StringFind(timeFrames,";",s); } totalTimeFrames = ArraySize(aTimes); totalPairs = ArraySize(aPairs); totalLabels = 0; return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { while (totalLabels>0) { ObjectDelete(StringConcatenate(labelNames,totalLabels)); totalLabels--;} return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { ObjectsDeleteAll( window, 21); ObjectsDeleteAll( window, 22); ObjectsDeleteAll( window, 23); int m,n; int i,k; window = WindowFind(shortName); totalLabels = 0; for (i=0,m=30; i < totalPairs; i++, m+=25){ INC_UP = 0; INC_UC = 0; INC_DN = 0; for (k=0,n=170; k < totalTimeFrames; k++, n+=46){ showPair(aPairs[i],aTimes[k],sTimes[k],m,n);} if (ShowCount) DoShowCount(m,n); } if (Pair1 == "") Pair1 = Symbol(); return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void DoShowCount( int xdistance, int ydistance ) { double PERp,PERC,PER; int yInc = -125; PER=INC_UP; PERC=PER*100; PERp=PERC/7; string PER_Str =DoubleToStr(PERp,Point); color xColor = Yellow ; if( PERp > 50) { xColor = LimeGreen ; } else if( PERp < 50 ) { xColor = Crimson ; } string M1= FastMAPeriod; string M2= SlowMAPeriod; string MT= strMAType; string RS= RSI_Period ; string RT =strRSIType; if ( show.CANDLE == true) show.RSI = false; if ( show.RSI == true) show.MA = false ; if ( show.MA == true) show.RSI = false ; if ( show.MA == true) show.CANDLE = false ; if(ValueSize>12) ValueSize=12; setObject(next(),"MT4 DASHBOARD INDICATOR © 2008 OTCFX",70,5, Gray ,ValueFont,7,0); if(show.SCORE){ setObject(next(),PER_Str,525,xdistance+10, xColor ,"Arial bold",10,0);} setObject(next(),Pair0,130,40, ValueColor ,ValueFont,ValueSize); setObject(next(),Pair1,130,65, ValueColor ,ValueFont,ValueSize); setObject(next(),Pair2,130,90, ValueColor ,ValueFont,ValueSize); setObject(next(),Pair3,130,115, ValueColor ,ValueFont,ValueSize); setObject(next(),Pair4,130,140, ValueColor ,ValueFont,ValueSize); setObject(next(),Pair5,130,165, ValueColor ,ValueFont,ValueSize); setObject(next(),Pair6,130,190, ValueColor ,ValueFont,ValueSize); setObject(next(),Pair7,130,215, ValueColor ,ValueFont,ValueSize); setObject(next(),Pair8,130,240, ValueColor ,ValueFont,ValueSize); setObject(next(),Pair9,130,265, ValueColor ,ValueFont,ValueSize); setObject(next(),Pair10,130,290, ValueColor ,ValueFont,ValueSize); setObject(next(),Pair11,130,315, ValueColor ,ValueFont,ValueSize); setObject(next(),Pair12,130,340, ValueColor ,ValueFont,ValueSize); setObject(next(),Pair13,130,365, ValueColor ,ValueFont,ValueSize); setObject(next(),Pair14,130,390, ValueColor ,ValueFont,ValueSize); setObject(next(),Pair15,130,415, ValueColor ,ValueFont,ValueSize); setObject(next(),Pair16,130,440, ValueColor ,ValueFont,ValueSize); setObject(next(),Pair17,130,465, ValueColor ,ValueFont,ValueSize); setObject(next(),Pair18,130,490, ValueColor ,ValueFont,ValueSize); setObject(next(),Pair19,130,515, ValueColor ,ValueFont,ValueSize); if(show.RSI){ setObject(next(),"*RSI-MODE-",340,3, ValueColor ,"Verdana Bold",ValueSize); setObject(next(),RS,435,3, ValueColor ,ValueFont,ValueSize); setObject(next(),RT,495,3, ValueColor ,ValueFont,ValueSize); setObject(next(),"TYPE:",455,3, ValueColor ,ValueFont,ValueSize);} if(show.MA){ setObject(next(),"*MA-MODE-",340,3, ValueColor ,"Verdana Bold",ValueSize); setObject(next(),M1,435,3, ValueColor ,ValueFont,ValueSize); setObject(next(),M2,465,3, ValueColor ,ValueFont,ValueSize); setObject(next(),MT,495,3, ValueColor ,ValueFont,ValueSize); setObject(next(),"/X",525,3, ValueColor ,ValueFont,ValueSize);} if(show.CANDLE){ setObject(next(),"*CANDLE-MODE",340,3, ValueColor ,"Verdana Bold",ValueSize);} setObject(next(),"PAIR",140,18, ValueColor ,ValueFont,ValueSize); setObject(next(),"M5",200,18, ValueColor ,ValueFont,ValueSize); setObject(next(),"M15",245,18, ValueColor ,ValueFont,ValueSize); setObject(next(),"M30",290,18, ValueColor ,ValueFont,ValueSize); setObject(next(),"H1",340,18, ValueColor ,ValueFont,ValueSize); setObject(next(),"H4",385,18, ValueColor ,ValueFont,ValueSize); setObject(next(),"D1",430,18, ValueColor ,ValueFont,ValueSize); setObject(next(),"W1",475,18, ValueColor ,ValueFont,ValueSize); if(show.SCORE){ setObject(next(),"%",525,18, ValueColor ,ValueFont,ValueSize);} } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void showPair(string pair, int timeFrame,string label, int xdistance, int ydistance) { double price,icl,icl1,ima1,ima2,srsi,srsi1; if(show.CANDLE){ icl = iClose(pair,timeFrame,0); icl1 = iOpen(pair,timeFrame,0);} if(show.MA){ ima1 = iMA(pair,timeFrame,FastMAPeriod,0,MAType,0,0); ima2 = iMA(pair,timeFrame,SlowMAPeriod,0,MAType,0,0);} if(show.RSI){ srsi = iRSI(pair,timeFrame ,RSI_Period,RSI_Type,0);} if(show.CANDLE){ setCANAr(icl,icl1);} if(show.RSI){ setRSIAr(srsi,price);} if(show.MA){ setMAColAr(ima1,ima2);} if(show.RSI){ setLabel(" " ,xdistance+10,ydistance+30," ",srsi_color,srsi_arrow);} if(show.MA){ setLabel(" " ,xdistance+10,ydistance+30," ",MA_color,MA_arrow);} if(show.CANDLE){ setLabel(" " ,xdistance+10,ydistance+30," ",cad_color,cad_arrow);} } //+------------------------------------------------------------------+ //| Custom functions and procedures | //+------------------------------------------------------------------+ string next() { totalLabels++; return(totalLabels); } void setCANAr(double icl,double icl1) { if(show.CANDLE){ if (icl>icl1) { INC_UP = INC_UP +1 ; cad_color = ColorUp; cad_arrow = "5"; } if (icl50) { INC_UP = INC_UP +1 ; srsi_color = ColorUp; srsi_arrow = "Ù"; } if (srsi<50) { INC_DN = INC_DN +1 ; srsi_color = ColorDown; srsi_arrow = "Ú"; } if (srsi==50) { INC_UC = INC_UC +1 ; srsi_color = ColorNeutral; srsi_arrow = "h"; }} } void setMAColAr(double ima1,double ima2) { if(show.MA){ if (ima1>ima2) { INC_UP = INC_UP +1 ; MA_color = ColorUp; MA_arrow = "Ù"; } if (ima1= 0) { char = StringGetChar(s, lenght); if((char > 96 && char < 123) || (char > 223 && char < 256)) s = StringSetChar(s, lenght, char - 32); else if(char > -33 && char < 0) s = StringSetChar(s, lenght, char + 224); lenght--; } return(s); } string MakeUniqueName(string first, string rest) { string result = first+(MathRand()%1001)+rest; while (WindowFind(result)> 0) result = first+(MathRand()%1001)+rest; return(result); } bool IsMini() { if (StringFind(Symbol(),"m") > -1) return(true); else return(false); }