Translate Indicator MT4>MT5 - Traduzir Indicador do MT4 pro MT5

MQL5 Dönüştürme

İş Gereklilikleri

//Este indicador elimina as bordas da janelas dos gráficos, aumentando a área útil.
//This indicator eliminates the borders of the chart windows, increasing the usable area.


#property indicator_chart_window
#property indicator_buffers 0
#property indicator_plots   0

#define _name "Borders_ON/Off"

extern ENUM_BASE_CORNER  corner = CORNER_RIGHT_LOWER;
extern ENUM_ANCHOR_POINT anchor = ANCHOR_LEFT_LOWER;
extern int Xsize = 32;
extern int Ysize = 20;
extern int XPos = 33;
extern int YPos = 21;

//+------------------------------------------------------------------+
//| OnInit                                                           |
//+------------------------------------------------------------------+
int OnInit()
{
   if(ObjectFind(0,_name)<0)     ObjectCreate(0,_name,OBJ_BUTTON,0,0,0);
   
   ObjectSetInteger(0,_name,OBJPROP_XDISTANCE,XPos);
   ObjectSetInteger(0,_name,OBJPROP_YDISTANCE,YPos);
   ObjectSetInteger(0,_name,OBJPROP_XSIZE,Xsize);
   ObjectSetInteger(0,_name,OBJPROP_YSIZE,Ysize);
   ObjectSetInteger(0,_name,OBJPROP_CORNER,corner);
   ObjectSetInteger(0,_name,OBJPROP_ANCHOR,anchor);
   ObjectSetInteger(0,_name,OBJPROP_BORDER_TYPE,BORDER_FLAT);
   ObjectSetInteger(0,_name,OBJPROP_BGCOLOR,C'40,40,40');
   ObjectSetInteger(0,_name,OBJPROP_BORDER_COLOR,C'120,120,120');
   ObjectSetString(0,_name,OBJPROP_TEXT,ObjectGetInteger(0,_name,OBJPROP_STATE)?"ON":"OFF");
   
   manageWindows(ObjectGetInteger(0,_name,OBJPROP_STATE)); 
   
   return(INIT_SUCCEEDED);
}


//+------------------------------------------------------------------+
//| OnDeinit                                                         |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
  if(reason==REASON_REMOVE) ObjectDelete(0,_name); 
  return;
}


//+------------------------------------------------------------------+
//| OnInit                                                           |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                   const int prev_calculated,
                   const datetime &time[],
                   const double &open[],
                   const double &high[],
                   const double &low[],
                   const double &close[],
                   const long &tick_volume[],
                   const long &volume[],
                   const int &spread[])
{
  return(rates_total);
}
                   
                   
//+------------------------------------------------------------------+
//| OnInit                                                           |
//+------------------------------------------------------------------+
void OnChartEvent(const int id, const long& lparam, const double& dparam, const string& sparam)
{
   if(id==CHARTEVENT_OBJECT_CLICK && sparam==_name)
   {
     ObjectSetString(0,_name,OBJPROP_TEXT,ObjectGetInteger(0,_name,OBJPROP_STATE)?"ON":"OFF"); 
     manageWindows(ObjectGetInteger(0,_name,OBJPROP_STATE));
   } 
   return;
}
                          
                          
                          
                          
//+--------------------------------------------------------------------------------------+
#import "user32.dll"
  int SetWindowLongA(int hWnd,int nIndex, int dwNewLong);
  int GetWindowLongA(int hWnd,int nIndex);
  int SetWindowPos(int hWnd, int hWndInsertAfter,int X, int Y, int cx, int cy, int uFlags);
  int GetParent(int hWnd);
  int GetTopWindow(int hWnd);
  int GetWindow(int hWnd, int wCmd);
#import
//+--------------------------------------------------------------------------------------+
#define GWL_STYLE         -16 
#define WS_CAPTION        0x00C00000 
#define WS_BORDER         0x00800000
#define WS_SIZEBOX        0x00040000
#define WS_DLGFRAME       0x00400000
#define SWP_NOSIZE        0x0001
#define SWP_NOMOVE        0x0002
#define SWP_NOZORDER      0x0004
#define SWP_NOACTIVATE    0x0010
#define SWP_FRAMECHANGED  0x0020
#define GW_CHILD          0x0005
#define GW_HWNDNEXT       0x0002
//+--------------------------------------------------------------------------------------+



//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void manageWindows(bool state)
{
   int hChartParent = GetParent((int)ChartGetInteger(ChartID(),CHART_WINDOW_HANDLE));    
   int hMDIClient   = GetParent(hChartParent); 
   int hChildWindow = GetTopWindow(hMDIClient);    
   while(hChildWindow>0)
   {
     ManageBorderByWindowHandle(hChildWindow,state); 
     hChildWindow=GetWindow(hChildWindow,GW_HWNDNEXT);
   }
}


//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void ManageBorderByWindowHandle(int hWindow,bool state)
{
   int iNewStyle;
   if(state) 
     iNewStyle = GetWindowLongA(hWindow, GWL_STYLE) & (~(WS_BORDER | WS_DLGFRAME | WS_SIZEBOX));    
   else 
     iNewStyle = GetWindowLongA(hWindow, GWL_STYLE) | ( (WS_BORDER | WS_DLGFRAME | WS_SIZEBOX)); 
   
   if(hWindow>0 && iNewStyle>0)
   {
     SetWindowLongA(hWindow,GWL_STYLE,iNewStyle);
     SetWindowPos(hWindow,0,0,0,0,0,SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_FRAMECHANGED);
   }
}
   
   
//+FIM-------------------------------------------------------------------------------------------------------+

Dosyalar:

MQ4
Borders.mq4
5.4 Kb

Yanıtlandı

1
Geliştirici 1
Derecelendirme
(19)
Projeler
23
22%
Arabuluculuk
0
Süresi dolmuş
1
4%
Çalışıyor
2
Geliştirici 2
Derecelendirme
(250)
Projeler
460
26%
Arabuluculuk
140
20% / 59%
Süresi dolmuş
100
22%
Çalışıyor
3
Geliştirici 3
Derecelendirme
(540)
Projeler
622
33%
Arabuluculuk
37
38% / 51%
Süresi dolmuş
11
2%
Meşgul
4
Geliştirici 4
Derecelendirme
(2)
Projeler
2
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
5
Geliştirici 5
Derecelendirme
(1)
Projeler
2
50%
Arabuluculuk
2
0% / 100%
Süresi dolmuş
0
Serbest

Proje bilgisi

Bütçe
30+ USD