Auftrag beendet


Spezifikation
each pane row heights are defined in externvariables
#define SUBWINDOW4 "Trade Window"
use SubwindowTemplate to open the 4 windows above, height = 60 pixel/pane, show subwindow shortname on the top left corner of the subwindows
Obtain the full height without subwindow of the Main Chart in pixels. 80% of total Chart height dedicated to 4 panes. each pane will have 20% max chart pixel and divide that by 12 maximum rows and 30 maximum column
save these pixel heights in int m_YDistance[Y_DISTANCE_BUFFER];
example, total height of chart = 1000 pixels. 800 pixel dedicated to the subwindows. each subwindows have a maximum of 12 rows. so 800 pixels/4 panes = 200 pixel/12 rows = ......
instead of using iCustoms to open the subwindows use hash to open the windows instead
like the following:-
CGraphics::Graphics()
[
m_WindowsHash=new Hash(); // create new hash to manage the window handlers
}
CGraphics::InitTechnicalAnalysisWindow0(string WindowName)
{
if(!InitSubwindow(WindowName))
{
printf("Fail to Init Sub-Window Name = "+WindowName);
return false;
}
int windowID = ChartWindowFind(m_WindowID[1], WindowName);
if(windowID<0)
return false;
ResizeSubWindow(WindowName,m_ChartHeightPixel[1]);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
bool Graphics::StartCustomIndicator(int hWnd,string ChartName,bool AutomaticallyAcceptDefaults=false)
{
ResetLastError();
printf("Start Custom Indicator");
uchar charArrayIndicatorName[];
StringToCharArray(ChartName,charArrayIndicatorName,0);
// printf("charArrayIndicatorName = "+charArrayIndicatorName);
int MessageNumber=RegisterWindowMessageW("MetaTrader4_Internal_Message");
int res=SendMessageW(hWnd,MessageNumber,15,charArrayIndicatorName);
if(res)
{
LogError(__FUNCTION__,"Failed to post a msg winAPI",GetLastError());
return false;
}
return true;
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
bool Graphics::InitSubwindow(string ChartName)
{
ResetLastError();
if(WindowFind(ChartName)>0)
{
if(m_WindowsHash.hGetInt(ChartName) < 0)
m_WindowsHash.hPutInt(ChartName,WindowFind(ChartName));
return true;
}
int hWnd=WindowHandle(Symbol(),0);
if(!hWnd)
{
LogError(__FUNCTION__,"Window not found",GetLastError());
return false;
}
bool res=StartCustomIndicator(hWnd,ChartName);
if(WindowFind(ChartName)<0)
{
MessageBox(ChartName+" Indicator window not found.","ERROR",MB_ICONERROR);
LogError(__FUNCTION__,ChartName+" Indicator window not found",GetLastError());
return false;
}
if(res)
m_WindowsHash.hPutInt(ChartName,WindowFind(ChartName));
return res;
}