Yes try
SymbolSelect
Selects a symbol in the Market Watch window or removes a symbol from the window.
bool SymbolSelect( string name, // symbol name bool select // add or remove );
name
[in] Symbol name.
select
[in] Switch. If the value is false, a symbol should be removed from MarketWatch, otherwise a symbol should be selected in this window. A symbol can't be removed if the symbol chart is open, or there are open positions for this symbol.
Return Value
In case of failure returns false.
Thank You Marco,
Though the question was not about add/remove from MarketWatch, but about the Profile (see Ctrl F5). Sorry is it was not clear.
Browsing the manual the attention went now to ChartOperation, and I brewed as below.
Now I can add (remove not tested yet) and tile/cascade the symbols, and also apply an existing template.
But then back to the question... can this now we saved/retrieved to/from a Profile ?
The final purpuse is to dynamically populate a Profile with all Symbols with open orders.
Cheers,
T
PS : MvdH sounds very Dutch
#import "user32.dll"
int GetParent(int hWnd);
int GetAncestor(int, int);
int SendMessageA(int hWnd, int Msg, int wParam, int lParam);
int PostMessageA(int hWnd, int Msg, int wParam, int lParam);
#import
#define WM_MDITILE 0x226
#define WM_MDICASCADE 0x0227
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//---
bool sel;
long chrt;
// sel = SymbolSelect("DE30",true);
chrt = ChartOpen("N25",0);
ChartApplyTemplate(chrt,"TVA");
Print (chrt);
int wHandle=(int)ChartGetInteger(0,CHART_WINDOW_HANDLE);
int hMDI = GetParent(GetParent(wHandle));
// int ret=SendMessageA(hMDI, WM_MDICASCADE, 0, 0);
int ret=SendMessageA(hMDI, WM_MDITILE, 0, 0);
}
Thank You Marco,
#import "user32.dll"
int GetParent(int hWnd);
int GetAncestor(int, int);
int SendMessageA(int hWnd, int Msg, int wParam, int lParam);
int PostMessageA(int hWnd, int Msg, int wParam, int lParam);
#import
#define WM_MDITILE 0x226
#define WM_MDICASCADE 0x0227
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//---
bool sel;
long chrt;
// sel = SymbolSelect("DE30",true);
chrt = ChartOpen("N25",0);
ChartApplyTemplate(chrt,"TVA");
Print (chrt);
int wHandle=(int)ChartGetInteger(0,CHART_WINDOW_HANDLE);
int hMDI = GetParent(GetParent(wHandle));
// int ret=SendMessageA(hMDI, WM_MDICASCADE, 0, 0);
int ret=SendMessageA(hMDI, WM_MDITILE, 0, 0);
}
Hi,
We can read it better ʘ‿ʘ if you use SRC
Hi,
We can read it better ʘ‿ʘ if you use SRC
Thank You Yohana.
Was my first post, and will do.
This script now works and all open orders are selected and displayed as a chart. Only now need to add an interval for automatic refresh.
I assume there are no functions in mq4 to work with a "Profile".
Cheers,
T
//+------------------------------------------------------------------+ //| tva Test add Chart.mq4 | //| tva | //| | //+------------------------------------------------------------------+ #property copyright "tva" #property link "https://www.mql5.com" #property version "1.00" #property strict #import "user32.dll" int GetParent(int hWnd); int GetAncestor(int, int); int SendMessageA(int hWnd, int Msg, int wParam, int lParam); int PostMessageA(int hWnd, int Msg, int wParam, int lParam); #import #define WM_MDITILE 0x226 //#define WM_MDICASCADE 0x0227 //extern int IntervalMinuten=15; void OnStart() { int total=OrdersTotal(); string sn; long chrt; ProfileClear(); for(int i=0;i<total;i++) { sn = SymbolName(i,true); if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==TRUE) { chrt = ChartOpen(OrderSymbol(),0); // ChartApplyTemplate(chrt,"TVA"); } } TileCharts(); } //+------------------------------------------------------------------+ void ProfileClear() { long currChart,prevChart=ChartFirst(); int i=0,limit=100; // Print("ChartFirst =",ChartSymbol(prevChart)," ID =",prevChart); do { currChart=ChartNext(prevChart); if(currChart<0) break; // Have reached the end of the chart list // Print(i,ChartSymbol(currChart)," ID =",currChart); ChartClose(currChart); prevChart=currChart; i++; } while(i<limit); } void TileCharts() { int wHandle=(int)ChartGetInteger(0,CHART_WINDOW_HANDLE); int hMDI = GetParent(GetParent(wHandle)); // int ret=SendMessageA(hMDI, WM_MDICASCADE, 0, 0); int ret=SendMessageA(hMDI, WM_MDITILE, 0, 0); }
Is there any command I can use to make uniform size of sub-windows? I want to attach 8 sub-windows of equal length to single main chart.
oye,
i noticed that indeed the Tile not always results in equally distributed Charts. Sometimes it does, sometimes it doesn't. it is a Windows API that is used.
Why 8 ? We work with a robot, and this mq4 has to reflect any/all open orders.
Also noticed that there may be multiple charts for the same Symbol... reason is that we have multiple Strategies that may generate the same Symbol. That we have to work out too.
Cheers,
T
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
In MT4 a Profile is a collection of charts projected as 1 window.
one can add or remove additional symbols manually
is there a way to populate a Profile automatically ? and reflect all symbols with open orders.
so we are looking for functions/script to add/remove a symbol from the Profile.
Thanks in advance
T