PasteObjects

Miscellaneous
It opens Message Boxes to the userIt plays sound alertsUses files from the file systemIt issuies visual alerts to the screenIt reads information from a file
0 Views
0 Downloads
0 Favorites
PasteObjects
ÿþ#include <WinUser32.mqh> // ;O ?@54C?@5645=8O >1 C40;5=88 >1J5:B>2

#property strict

//+-----------------------------------------------------------------------------------------------+

bool DeleteObjects = true;  // #40;OBL AB0@K5 >1J5:BK ?5@54 CAB0=>2:>9 =>2KE

bool Warning = true;        // @54C?@5640BL >1 C40;5=88 >1J5:B>2

//+-----------------------------------------------------------------------------------------------+

int handle,TYP;

string imya,text,adres;

//+HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH+

void OnStart()

  {

//+=========================================================================================================+

   if(DeleteObjects)

     {

      if(Warning)

        {

         int ret=MessageBox("A5 >1J5:BK 1C4CB C40;5=K","PasteObjects",MB_OKCANCEL);

         if(ret==IDCANCEL){PlaySound("timeout.wav"); return;}

        }

      ObjectsDeleteAll(0,0,0); ObjectsDeleteAll(0,0,1); ObjectsDeleteAll(0,0,2); ObjectsDeleteAll(0,0,10);

     }

//+=========================================================================================================+

  adres="GetSetObjects\\"+Symbol()+".txt";

//+-----------------------------------------------------------------------------------------------+

   handle=FileOpen(adres,FILE_READ|FILE_COMMON);

   if(handle==INVALID_HANDLE){Alert("No copied data "+Symbol()); return;}

//+-----------------------------------------------------------------------------------------------+

   while(true)

     {

      text=FileReadString(handle);

      if(StringLen(text)==0)

        {

         FileClose(handle); ChartRedraw(0);

         PlaySound("ok.wav"); return;

        }

      if(StringFind(text,"TYP")>=0){TYP=(int)StringSubstr(text,3);}else {continue;}

      //+-----------------------------------------------------------------------------------------------------+ V.LINE

      if(TYP==0)

        {

         //+---------------------------------------------------------------------------------+

         imya=FileReadString(handle);

         int WIDTH=(int)FileReadString(handle);

         int STYLE=(int)FileReadString(handle);

         int TFRAMES=(int)FileReadString(handle);

         color COLOR=(color)(int)FileReadString(handle);

         int TIME=(int)FileReadString(handle);

         //+---------------------------------------------------------------------------------+

         ObjectCreate(0,imya,OBJ_VLINE,0,TIME,0);

         ObjectSetInteger(0,imya,OBJPROP_WIDTH,WIDTH);

         ObjectSetInteger(0,imya,OBJPROP_COLOR,COLOR);

         ObjectSetInteger(0,imya,OBJPROP_STYLE,STYLE);

         ObjectSetInteger(0,imya,OBJPROP_TIMEFRAMES,TFRAMES);

         continue;

        }

      //+-----------------------------------------------------------------------------------------------------+ H.LINE

      if(TYP==1)

        {

         //+---------------------------------------------------------------------------------+

         imya=FileReadString(handle);

         int WIDTH=(int)FileReadString(handle);

         int STYLE=(int)FileReadString(handle);

         int TFRAMES=(int)FileReadString(handle);

         color COLOR=(color)(int)FileReadString(handle);

         double PRICE=(double)FileReadString(handle);

         //+---------------------------------------------------------------------------------+

         ObjectCreate(0,imya,OBJ_HLINE,0,0,PRICE);

         ObjectSetInteger(0,imya,OBJPROP_WIDTH,WIDTH);

         ObjectSetInteger(0,imya,OBJPROP_COLOR,COLOR);

         ObjectSetInteger(0,imya,OBJPROP_STYLE,STYLE);

         ObjectSetInteger(0,imya,OBJPROP_TIMEFRAMES,TFRAMES);

         continue;

        }

      //+-----------------------------------------------------------------------------------------------------+  T.LINE

      if(TYP==2)

        {

         imya=FileReadString(handle);

         int WIDTH=(int)FileReadString(handle);

         int STYLE=(int)FileReadString(handle);

         int TFRAMES=(int)FileReadString(handle);

         color COLOR=(color)(int)FileReadString(handle);

         int RAY=(int)FileReadString(handle);

         int TIME1=(int)FileReadString(handle);

         int TIME2=(int)FileReadString(handle);

         double PRICE1=(double)FileReadString(handle);

         double PRICE2=(double)FileReadString(handle);

         //+---------------------------------------------------------------------------------+

         ObjectCreate(0,imya,OBJ_TREND,0,TIME1,PRICE1,TIME2,PRICE2);

         ObjectSetInteger(0,imya,OBJPROP_WIDTH,WIDTH);

         ObjectSetInteger(0,imya,OBJPROP_COLOR,COLOR);

         ObjectSetInteger(0,imya,OBJPROP_STYLE,STYLE);

         ObjectSetInteger(0,imya,OBJPROP_TIMEFRAMES,TFRAMES);

         ObjectSetInteger(0,imya,OBJPROP_RAY,RAY);

         continue;

        }

      //+-----------------------------------------------------------------------------------------------------+  F.LINE

      if(TYP==10)

        {

         //+---------------------------------------------------------------------------------+

         imya=FileReadString(handle);

         int WIDTH=(int)FileReadString(handle);

         int LvlWIDTH=(int)FileReadString(handle);

         int STYLE=(int)FileReadString(handle);

         int LvlSTYLE=(int)FileReadString(handle);

         int TFRAMES=(int)FileReadString(handle);

         color COLOR=(color)(int)FileReadString(handle);

         color LvlCOLOR=(color)(int)FileReadString(handle);

         int RAY=(int)FileReadString(handle);

         int TIME1=(int)FileReadString(handle);

         int TIME2=(int)FileReadString(handle);

         double PRICE1=(double)FileReadString(handle);

         double PRICE2=(double)FileReadString(handle);

         //+=========================================================================================================+

         ObjectCreate(0,imya,OBJ_FIBO,0,TIME1,PRICE1,TIME2,PRICE2);

         int levels=(int)FileReadString(handle);

         ObjectSetInteger(0,imya,OBJPROP_LEVELS,levels);

         //+-----------------------------------------------------------------------------------------------+

         for(int i=0; i<levels; i++)

           {

            double value=(double)FileReadString(handle);

            ObjectSetDouble(0,imya,OBJPROP_LEVELVALUE,i,value);

            text=FileReadString(handle);

            ObjectSetString(0,imya,OBJPROP_LEVELTEXT,i,text);

           }

         //+-----------------------------------------------------------------------------------------------+

         ObjectSetInteger(0,imya,OBJPROP_WIDTH,WIDTH);

         ObjectSetInteger(0,imya,OBJPROP_LEVELWIDTH,LvlWIDTH);

         ObjectSetInteger(0,imya,OBJPROP_STYLE,STYLE);

         ObjectSetInteger(0,imya,OBJPROP_LEVELSTYLE,LvlSTYLE);

         ObjectSetInteger(0,imya,OBJPROP_COLOR,COLOR);

         ObjectSetInteger(0,imya,OBJPROP_LEVELCOLOR,LvlCOLOR);

         ObjectSetInteger(0,imya,OBJPROP_TIMEFRAMES,TFRAMES);

         ObjectSetInteger(0,imya,OBJPROP_RAY,RAY);

         //+=========================================================================================================+

        }

     }

  }

//+HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH+

Comments