Snarl





//+------------------------------------------------------------------+
//|                                                        Snarl.mq4 |
//|                                                          Roffild |
//|                                 http://codebase.mql4.com/ru/5670 |
//+------------------------------------------------------------------+

// Íåîáõîäèìî "Ðàçðåøèòü èìïîðò DLL"

#property copyright "Roffild"
#property link      "http://codebase.mql4.com/ru/5670"

#property indicator_chart_window

//---------------------------------------
#import "kernel32.dll"
int WinExec(string cmd, int showConsole);
#import
//---------------------------------------

extern color HLine_small_BID = CornflowerBlue;
extern color HLine_big_BID = SkyBlue;
extern color HLine_small_ASK = Coral;
extern color HLine_big_ASK = LightCoral;
//---------------------------------------
extern color VLine = Orchid;
extern color VLine_big = HotPink;
//---------------------------------------
// Trendline.......... no

extern int TimeOut = 15;
extern string Snarl_Title = "MetaTrader";
extern string Snarl_CMD = "\"c:\\program files\\full phat\\snarl\\snarl_cmd.exe\"";

int start()
{
   //Print("HLine_small_BID=",HLine_small_BID,", HLine_big_BID=",HLine_big_BID,", HLine_small_ASK=",HLine_small_ASK,", HLine_big_ASK=",HLine_big_ASK,", VLine=",VLine,", VLine_big=",VLine_big,", TimeOut=",TimeOut);

   int obj_total=ObjectsTotal();
   string objname, objdesc="";

   for(int i=0;i<obj_total;i++)
   {
      objname = ObjectName(i);
      if (ObjectType(objname) == OBJ_HLINE)
      {
         //Print(TimeToStr(TimeCurrent(), TIME_DATE|TIME_SECONDS)," < ",(GetLastTime(ObjectDescription(objname)) + TimeOut));
         if (TimeCurrent() < (GetLastTime(ObjectDescription(objname)) + TimeOut)) continue;
         if (GetLastTime(ObjectDescription(objname)) > 0)
         {
            if (StringLen(ObjectDescription(objname)) > 11) objdesc = StringSubstr(ObjectDescription(objname), 0, StringLen(ObjectDescription(objname))-11);
               else objdesc = "";
         }
         else objdesc = ObjectDescription(objname);
         //Print(objname," ",ObjectGet(objname, OBJPROP_COLOR),"==",vcolor," ",ObjectGet(objname, OBJPROP_PRICE1));
         if (ObjectGet(objname, OBJPROP_COLOR) == HLine_small_BID &&
             ObjectGet(objname, OBJPROP_PRICE1) < Bid)
         {
            Print(TimeOut," \"",Snarl_Title,"\" \"",Symbol()," ",TimeToStr(TimeCurrent())," BID: ",Bid," ASK: ",Ask," Description: ",objdesc,"\"");
            snarl(TimeOut+" \""+Snarl_Title+"\" \""+Symbol()+"\n"+TimeToStr(TimeCurrent())+"\nBID: "+Bid+"\nASK: "+Ask+"\nDescription:\n"+objdesc+"\"");
            ObjectSetText(objname, objdesc + ";" + TimeCurrent());
            continue;
         }
         if (ObjectGet(objname, OBJPROP_COLOR) == HLine_big_BID &&
             ObjectGet(objname, OBJPROP_PRICE1) > Bid)
         {
            Print(TimeOut," \"",Snarl_Title,"\" \"",Symbol()," ",TimeToStr(TimeCurrent())," BID: ",Bid," ASK: ",Ask," Description: ",objdesc,"\"");
            snarl(TimeOut+" \""+Snarl_Title+"\" \""+Symbol()+"\n"+TimeToStr(TimeCurrent())+"\nBID: "+Bid+"\nASK: "+Ask+"\nDescription:\n"+objdesc+"\"");
            ObjectSetText(objname, objdesc + ";" + TimeCurrent());
            continue;
         }

         if (ObjectGet(objname, OBJPROP_COLOR) == HLine_small_ASK &&
             ObjectGet(objname, OBJPROP_PRICE1) < Ask)
         {
            Print(TimeOut," \"",Snarl_Title,"\" \"",Symbol()," ",TimeToStr(TimeCurrent())," BID: ",Bid," ASK: ",Ask," Description: ",objdesc,"\"");
            snarl(TimeOut+" \""+Snarl_Title+"\" \""+Symbol()+"\n"+TimeToStr(TimeCurrent())+"\nBID: "+Bid+"\nASK: "+Ask+"\nDescription:\n"+objdesc+"\"");
            ObjectSetText(objname, objdesc + ";" + TimeCurrent());
            continue;
         }
         if (ObjectGet(objname, OBJPROP_COLOR) == HLine_big_ASK &&
             ObjectGet(objname, OBJPROP_PRICE1) > Ask)
         {
            Print(TimeOut," \"",Snarl_Title,"\" \"",Symbol()," ",TimeToStr(TimeCurrent())," BID: ",Bid," ASK: ",Ask," Description: ",objdesc,"\"");
            snarl(TimeOut+" \""+Snarl_Title+"\" \""+Symbol()+"\n"+TimeToStr(TimeCurrent())+"\nBID: "+Bid+"\nASK: "+Ask+"\nDescription:\n"+objdesc+"\"");
            ObjectSetText(objname, objdesc + ";" + TimeCurrent());
            continue;
         }
      }
      
      if (ObjectType(objname) == OBJ_VLINE)
      {
         if (TimeCurrent() < (GetLastTime(ObjectDescription(objname)) + TimeOut)) continue;
         if (GetLastTime(ObjectDescription(objname)) > 0)
         {
            if (StringLen(ObjectDescription(objname)) > 11) objdesc = StringSubstr(ObjectDescription(objname), 0, StringLen(ObjectDescription(objname))-11);
               else objdesc = "";
         }
         else objdesc = ObjectDescription(objname);
      //Print(ObjectGet(objname, OBJPROP_COLOR)," == ",VLine,", ",TimeToStr(ObjectGet(objname, OBJPROP_TIME1)));
         if (ObjectGet(objname, OBJPROP_COLOR) == VLine &&
             ObjectGet(objname, OBJPROP_TIME1) > TimeCurrent()-60 && ObjectGet(objname, OBJPROP_TIME1) < TimeCurrent()+60)
         {
            Print(TimeOut," \"",Snarl_Title,"\" \"",Symbol()," ",TimeToStr(TimeCurrent())," BID: ",Bid," ASK: ",Ask," Description: ",objdesc,"\"");
            snarl(TimeOut+" \""+Snarl_Title+"\" \""+Symbol()+"\n"+TimeToStr(TimeCurrent())+"\nBID: "+Bid+"\nASK: "+Ask+"\nDescription:\n"+objdesc+"\"");
            ObjectSetText(objname, objdesc + ";" + TimeCurrent());
            continue;
         }
         if (ObjectGet(objname, OBJPROP_COLOR) == VLine_big &&
             ObjectGet(objname, OBJPROP_TIME1) < TimeCurrent())
         {
            Print(TimeOut," \"",Snarl_Title,"\" \"",Symbol()," ",TimeToStr(TimeCurrent())," BID: ",Bid," ASK: ",Ask," Description: ",objdesc,"\"");
            snarl(TimeOut+" \""+Snarl_Title+"\" \""+Symbol()+"\n"+TimeToStr(TimeCurrent())+"\nBID: "+Bid+"\nASK: "+Ask+"\nDescription:\n"+objdesc+"\"");
            ObjectSetText(objname, objdesc + ";" + TimeCurrent());
            continue;
         }
      }
   }
   return(1);
}

void snarl(string str)
{
   WinExec(Snarl_CMD + " snShowMessage " + str, 0);
}

int GetLastTime(string str)
{
   return( StrToInteger(StringSubstr(str, StringLen(str)-10)) );
}
// the end.



Sample





Analysis



Market Information Used:



Indicator Curves created:


Indicators Used:



Custom Indicators Used:
kernel32

Order Management characteristics:

Other Features: