Time: 2012-10-24 | Download file:WS[W].mq4
//+------------------------------------------------------------------+ //| WS[1].mq4 | //| Copyright © 2007, Lider Rostov | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "Copyright © 2007, Lider Rostov" #property link "http://www.metaquotes.net" //+------------------------------------------------------------------+ //| script program start function | //+------------------------------------------------------------------+ #include#import "user32.dll" bool GetCursorPos(int& Pos[2]); bool GetWindowRect(int hWnd,int& Pos[4]); int GetClientRect(int hWnd,int lpRect[]); int GetAsyncKeyState(int Key); int GetKeyState(int Key); int LMouse; int KoordMouse(bool x) { int XY; int p[2]; int rect[4]; int hwnd=WindowHandle(Symbol(),Period()); if(hwnd>0) { GetWindowRect(hwnd,rect); GetCursorPos(p); if (!x) XY=-rect[0]+p[0]; else XY=-rect[1]+p[1]; return(XY); } else { MessageBox("Ошибка при выделении идентификатора окна!",0,0); return(1); } } double Delitel(bool x) { double DiapazonP,Result,tics,seconds,VPixels,GPixels; int rect[4]; DiapazonP = WindowPriceMax(0) - WindowPriceMin(0); tics = DiapazonP/Point; // seconds = Period()*60*(WindowBarsPerChart()+1); int hwnd=WindowHandle(Symbol(),Period()); if(hwnd>0) { GetClientRect(hwnd,rect); if (!x) { GPixels = rect[2]; //кол-во пикселов по горизонтали Result =(WindowBarsPerChart()+1)/(GPixels-40); } else { VPixels = rect[3]; //кол-во пикселов по вертикали Result = tics/(VPixels-15); } // Print (DiapazonT);//ObjectGet("Text111",OBJPROP_TIME1)); return(Result); } else { MessageBox("Ошибка при выделении идентификатора окна!",0,0); return(1); } } string ObPodCenoi() { string name,nameB=""; double Price1,Time1,RaznPixelsP,RaznPixelsT; int PixelsP,PixelsT; double SummaPixels = 10000000; for(int x=0;x 24 && i==1) { simvOut = str[i-1][0]; return (simvOut); } if (j<=24 && i==2) { n = 6-MathAbs((30-j-1)/5); simvOut = str[i-2][j+(5*n-j)]; return (simvOut); } if (j>24 && i==2) { simvOut = str[i-2][0]; return (simvOut); } } } } return (""); } void Vivod() { string NameOb = ObPodCenoi(); double FontSize0 = ObjectGet(NameOb,OBJPROP_FONTSIZE); double MA; double Price1 = ObjectGet(NameOb,OBJPROP_PRICE1); double Time1 = ObjectGet(NameOb,OBJPROP_TIME1); color ColorNameOb = ObjectGet(NameOb,OBJPROP_COLOR); double n; color ColorText; string char = OprVivodOb(); string name,name1="",od; string print0; int PorNom=0; if (char != "" && char != " ") { if (StringGetChar(char,0)=='[') {ColorText = col1; print0 = print1;} else if (StringGetChar(char,0)=='(') {ColorText = col2; print0 = print2;} else {ColorText = col3; print0 = print3;} if (LMouse>=0 && ColorNameOb == AltColorText) ColorText = AltColorText; if ((char=="[i]" || char=="[a]" || char=="[W]" || char=="[w]")&&LMouse>=0) FontSize0 = FontSize0-step; MA = iMA(0,0,1,0,MODE_EMA,PRICE_CLOSE,iBarShift(0,0,Time1)); if (!position) if (Price1>MA) n = distance*Delitel(1)*Point; else n =-1*distance*Delitel(1)*Point; else if (Price1 PorNom) { PorNom = StrToInteger(od); } } } } if (PorNom == 0) name1 = "WS1"; else name1 = StringConcatenate("WS",PorNom+1); if (LMouse<0) { n=0; Time1 = ObjectGet(NameOb,OBJPROP_TIME1); if (ColorNameOb != AltColorText) ColorText = AltColorText; ObjectDelete(NameOb); } if (!ObjectCreate(name1,OBJ_TEXT,0,Time1,Price1+n)) MessageBox ("Ошибка вывода объекта",0,0); else { ObjectSetText(name1,char,FontSize0,print0,ColorText); // ObjectSet(NameOb,OBJPROP_COLOR,ColorText); } } else if (char=="") MessageBox("На графике нет текстовых объектов или неверный формат указанного объекта!",0,0); else MessageBox("Объект не в зоне графика! ",0,0); } int start() { //---- if (IsDllsAllowed( )) { LMouse = GetKeyState(LupdownKey); Vivod(); } else MessageBox ("Импорт dll запрещен. Разрешите импорт dll.",0,0); //ObPodCenoi(); //star(); //---- return(0); } //+------------------------------------------------------------------+