//+---------------------------------------------------------+ //| MarketMood.mq4 | //+---------------------------------------------------------+ #property copyright "StoneHeart" #property link "" #property indicator_chart_window #property indicator_buffers 8 #property indicator_color1 Red #property indicator_color2 DeepPink #property indicator_color3 Tomato #property indicator_color4 Orange #property indicator_color5 Yellow #property indicator_color6 Lime #property indicator_color7 Aqua #property indicator_color8 Blue #property indicator_style1 STYLE_DOT #property indicator_style2 STYLE_DOT #property indicator_style3 STYLE_DOT #property indicator_style4 STYLE_DOT #property indicator_style5 STYLE_DOT #property indicator_style6 STYLE_DOT #property indicator_style7 STYLE_DOT #property indicator_style8 STYLE_DOT //--- input parameters extern int TimeMX=3; // Multiply analized timeframe extern bool SignalAudio=false; // Enable Audio signals, and also LOG (regadless SignalLog) extern bool SignalLog=false; // Enable LOG signals, when Audio is OFF extern int SignalInterval=-1; // Time in Seconds between two signals, < 0 every time; Max=0) return; ObjectCreate(Name,OBJ_ARROW,0,iTime(NULL,0,0),0.999*iLow(NULL,0,0)); ObjectSet(Name,OBJPROP_ARROWCODE,241); ObjectSet(Name,OBJPROP_COLOR,ArrowColor); ObjectSet(Name,OBJPROP_WIDTH,3); if(SignalAudio) Alert(Name+" : BUY_"+Symbol()+"_@_="+DoubleToStr(iHigh(NULL,0,0),Digits)); else if(SignalLog) Print(Name+" : BUY_"+Symbol()+"_@_="+DoubleToStr(iHigh(NULL,0,0),Digits)); switch(ArrowColor) { case Lime : { ObjectSetText(Name,"BUY_@_="+DoubleToStr(iHigh(NULL,0,0),Digits)); break; } case Yellow : { ObjectSetText(Name,"SUPPORT="+DoubleToStr(iLow(NULL,0,0),Digits)); break; } } } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void ArrowDOWN(color ArrowColor) // Show Signal SELL { string Name=TimeToStr(iTime(NULL,0,0),TIME_DATE)+"="+TimeToStr(iTime(NULL,0,0),TIME_MINUTES); if(ObjectFind(Name)>=0) return; ObjectCreate(Name,OBJ_ARROW,0,iTime(NULL,0,0),1.004*iHigh(NULL,0,0)); ObjectSet(Name,OBJPROP_ARROWCODE,242); ObjectSet(Name,OBJPROP_COLOR,ArrowColor); ObjectSet(Name,OBJPROP_WIDTH,3); if(SignalAudio) Alert(Name+" : SELL_"+Symbol()+"_@_="+DoubleToStr(iLow(NULL,0,0),Digits)); else if(SignalLog) Print(Name+" : SELL_"+Symbol()+"_@_="+DoubleToStr(iLow(NULL,0,0),Digits)); switch(ArrowColor) { case Red : { ObjectSetText(Name,"SELL_@_="+DoubleToStr(iLow(NULL,0,0),Digits)); break; } case Yellow : { ObjectSetText(Name,"RESISTANCE="+DoubleToStr(iHigh(NULL,0,0),Digits)); break; } } } //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { SetIndexBuffer(0,T1); SetIndexBuffer(1,T2); SetIndexBuffer(2,T3); SetIndexBuffer(3,T4); SetIndexBuffer(4,T5); SetIndexBuffer(5,T6); SetIndexBuffer(6,T7); SetIndexBuffer(7,T8); SetIndexLabel(0,"MOOD_"+N1+" "); SetIndexLabel(1,"MOOD_"+N2+" "); SetIndexLabel(2,"MOOD_"+N3+" "); SetIndexLabel(3,"MOOD_"+N4+" "); SetIndexLabel(4,"MOOD_"+N5+" "); SetIndexLabel(5,"MOOD_"+N6+" "); SetIndexLabel(6,"MOOD_"+N7+" "); SetIndexLabel(7,"MOOD_"+N8+" "); IndicatorDigits(2); LastSignalTime=0; N1=1*TimeMX; N2=2*TimeMX; N3=3*TimeMX; N4=4*TimeMX; N5=5*TimeMX; N6=6*TimeMX; N7=7*TimeMX; N8=8*TimeMX; return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { if(PercentCoincidence<=0) { Alert(" WARNING : PercentCoincidence must be > 0 !"); return; } if(PercentCoincidence>=100) { Alert(" WARNING : PercentCoincidence must be < 100 !"); return; } if(TimeMX<=0) { Alert(" WARNING : TimeMX must be > 0 !!! ====="); return; } if(SignalInterval>=Period()) { Alert(" WARNING : SignalInterval must be < "+Period()+" !"); return; } int counted_bars=IndicatorCounted(); if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; int limit=Bars-counted_bars; int imax=MathMax(N1,N2); imax=MathMax(imax,MathMax(N3,N4)); imax=MathMax(imax,MathMax(N5,N6)); imax=MathMax(imax,MathMax(N7,N8)); if(counted_bars==0) limit-=1+imax; int I0=limit; // N8 I=I0; while(I>=0) { T8[I]=0; J=0; while(J=0) { T7[I]=0; J=0; while(J=0) { T6[I]=0; J=0; while(J=0) { T5[I]=0; J=0; while(J=0) { T4[I]=0; J=0; while(J=0) { T3[I]=0; J=0; while(J=0) { T2[I]=0; J=0; while(J=0) { T1[I]=0; J=0; while(JT7[0])+(T8[0]>T6[0])+(T8[0]>T5[0])+(T8[0]>T4[0])+(T8[0]>T3[0])+(T8[0]>T2[0])+(T8[0]>T1[0]) +(T7[0]>T6[0])+(T7[0]>T5[0])+(T7[0]>T4[0])+(T7[0]>T3[0])+(T7[0]>T2[0])+(T7[0]>T1[0])+(T6[0]>T5[0]) +(T6[0]>T4[0])+(T6[0]>T3[0])+(T6[0]>T2[0])+(T6[0]>T1[0])+(T5[0]>T4[0])+(T5[0]>T3[0])+(T5[0]>T2[0]) +(T5[0]>T1[0])+(T4[0]>T3[0])+(T4[0]>T2[0])+(T4[0]>T1[0])+(T3[0]>T2[0])+(T3[0]>T1[0])+(T2[0]>T1[0]); CoincidenceUP=(T8[0]=CoincidenceDOWN || PercentCoincidence<50) { mBid=iLow(NULL,0,1); if(( T8[0]>mBid && T7[0]>mBid && T6[0]>mBid && T5[0]>mBid && T4[0]>mBid && T3[0]>mBid && T2[0]>mBid && T1[0]>mBid)) { ArrowUP(Lime); LastSignalTime=TimeCurrent(); return; } if(CoincidenceUP>=PercentCoincidence*28/100) { ArrowUP(Yellow); LastSignalTime=TimeCurrent(); return; } } if(CoincidenceDOWN>=CoincidenceUP || PercentCoincidence<50) { mBid=iHigh(NULL,0,1); if(( T8[0]=PercentCoincidence*28/100) { ArrowDOWN(Yellow); LastSignalTime=TimeCurrent(); return; } } } } //+------------------------------------------------------------------+