Cowboy IBFX-US
ILQ-US
FINFX
PELLUCID
All four have similiar pending and open positions. The only difference is the risk/lot.
The attached FINFX just closed a basket of 4 trades. Most of the open positions are GREEN!
Thank You Mr. Long
Geges
Hi slipshod,slipshod wrote:I noticed that the buttons are all created regardless of whether showDisplay is true or false, and in the start() function there are a bunch of guiIsClicked() calls, again not checking showDisplay.
I enclosed all the areas with guiAdd() in them in the init() function within if (showDisplay) {... } and the same with the guiIsClicked() calls in the start() function, and CPU usage is once more low when showDisplay is set to false. Hence its reasonable to assume that the mt4gui library is causing the extra processing.
Code: Select all
if (showDisplay)
{
btnRefresh = guiAdd(hwnd, "button", 715, footerY2+80, 155, 20, "Grid Refresh");
btnCloseAll = guiAdd(hwnd, "button", 890, footerY2+80, 155, 20, "Close All Open Trades");
btnPendingDelete = guiAdd(hwnd, "button", 1065, footerY2+80, 155, 20, "Delete Pending");
}Code: Select all
if (showDisplay)
{
guiSetBgColor(hwnd, btnRefresh, btnColor);
guiSetTextColor(hwnd, btnRefresh, btnTextColor);
guiSetText(hwnd, btnRefresh, "Refresh Grid", 14, "Arial");
guiSetBgColor(hwnd, btnCloseAll, btnColor);
guiSetTextColor(hwnd, btnCloseAll, btnTextColor);
guiSetText(hwnd, btnCloseAll, "Close All Open", 14, "Arial");
guiSetBgColor(hwnd, btnPendingDelete, btnColor);
guiSetTextColor(hwnd, btnPendingDelete, btnTextColor);
guiSetText(hwnd, btnPendingDelete, "Delete Pending", 14, "Arial");
for (k = 0; (k < BUTTON_MAX) && (k < ArraySize(Pairs)); k++) {
buttonOpenChart[k] = guiAdd(hwnd, "button", kOffsetX, kOffsetY, 30, 15, "Chart");
guiSetBgColor(hwnd, buttonOpenChart[k], btnColor);
guiSetTextColor(hwnd, buttonOpenChart[k], btnTextColor);
guiSetText(hwnd, buttonOpenChart[k], "Chart", 10, "Arial");
buttonCloseTrade[k] = guiAdd(hwnd, "button", 1113, kOffsetY, 30, 15, "Close");
guiSetBgColor(hwnd, buttonCloseTrade[k], btnColor);
guiSetTextColor(hwnd, buttonCloseTrade[k], btnTextColor);
guiSetText(hwnd, buttonCloseTrade[k], "Close", 10, "Arial");
kOffsetY += 18;
}
}Code: Select all
if (showDisplay)
{
if (guiIsClicked(hwnd, btnRefresh)) {
refreshGrid();
}
if (guiIsClicked(hwnd, btnCloseAll)) {
if (MessageBox("Do you really want to Close ALL TRADES? ",
"Close All", MB_YESNO | MB_ICONQUESTION) != IDYES)
return(1);
CloseAll(maxSlippage(), MagicNumber);
}
if (guiIsClicked(hwnd, btnPendingDelete)) {
if (MessageBox("Do you really want to Delete All Pending? ",
"Delete All", MB_YESNO | MB_ICONQUESTION) != IDYES)
return(1);
canTrade = false;
DeletePendingTrades();
canTrade = true;
}
for (k = 0; k < BUTTON_MAX; k++) {
if (guiIsClicked(hwnd, buttonOpenChart[k]))
ChartWindow(Pairs[k], PERIOD_H4);
}
for (k = 0; k < BUTTON_MAX; k++) {
if(RunningTrades(Pairs[k]) ==0)
guiEnable( hwnd, buttonCloseTrade[k],false);
if (guiIsClicked(hwnd, buttonCloseTrade[k])) {
if (MessageBox(Pairs[k]+", Close this trade? ",
"Close Trade", MB_YESNO | MB_ICONQUESTION) != IDYES)
return(1);
CloseTrades(Pairs[k], maxSlippage(), MagicNumber);
}
}
UpdateGrid();
}Code: Select all
void refreshGrid() {
if ( showDisplay ) {
//CreateGrid();
UpdateGrid();
}
}fahedksa wrote:Today when i load latest version 2.1a Empty4 keep crashing and close.specally when i change time frame
Hi Mr.LongMrLong wrote:fahedksa wrote:Today when i load latest version 2.1a Empty4 keep crashing and close.specally when i change time frame
Have you installed the latest dll file?
Thanks slipshod.slipshod wrote:No problem Andy. In init() around line 450:-
then around line 600:-Code: Select all
if (showDisplay) { btnRefresh = guiAdd(hwnd, "button", 715, footerY2+80, 155, 20, "Grid Refresh"); btnCloseAll = guiAdd(hwnd, "button", 890, footerY2+80, 155, 20, "Close All Open Trades"); btnPendingDelete = guiAdd(hwnd, "button", 1065, footerY2+80, 155, 20, "Delete Pending"); }
The beginning of the start function:-Code: Select all
if (showDisplay) { guiSetBgColor(hwnd, btnRefresh, btnColor); guiSetTextColor(hwnd, btnRefresh, btnTextColor); guiSetText(hwnd, btnRefresh, "Refresh Grid", 14, "Arial"); guiSetBgColor(hwnd, btnCloseAll, btnColor); guiSetTextColor(hwnd, btnCloseAll, btnTextColor); guiSetText(hwnd, btnCloseAll, "Close All Open", 14, "Arial"); guiSetBgColor(hwnd, btnPendingDelete, btnColor); guiSetTextColor(hwnd, btnPendingDelete, btnTextColor); guiSetText(hwnd, btnPendingDelete, "Delete Pending", 14, "Arial"); for (k = 0; (k < BUTTON_MAX) && (k < ArraySize(Pairs)); k++) { buttonOpenChart[k] = guiAdd(hwnd, "button", kOffsetX, kOffsetY, 30, 15, "Chart"); guiSetBgColor(hwnd, buttonOpenChart[k], btnColor); guiSetTextColor(hwnd, buttonOpenChart[k], btnTextColor); guiSetText(hwnd, buttonOpenChart[k], "Chart", 10, "Arial"); buttonCloseTrade[k] = guiAdd(hwnd, "button", 1113, kOffsetY, 30, 15, "Close"); guiSetBgColor(hwnd, buttonCloseTrade[k], btnColor); guiSetTextColor(hwnd, buttonCloseTrade[k], btnTextColor); guiSetText(hwnd, buttonCloseTrade[k], "Close", 10, "Arial"); kOffsetY += 18; } }
And lastly...Code: Select all
if (showDisplay) { if (guiIsClicked(hwnd, btnRefresh)) { refreshGrid(); } if (guiIsClicked(hwnd, btnCloseAll)) { if (MessageBox("Do you really want to Close ALL TRADES? ", "Close All", MB_YESNO | MB_ICONQUESTION) != IDYES) return(1); CloseAll(maxSlippage(), MagicNumber); } if (guiIsClicked(hwnd, btnPendingDelete)) { if (MessageBox("Do you really want to Delete All Pending? ", "Delete All", MB_YESNO | MB_ICONQUESTION) != IDYES) return(1); canTrade = false; DeletePendingTrades(); canTrade = true; } for (k = 0; k < BUTTON_MAX; k++) { if (guiIsClicked(hwnd, buttonOpenChart[k])) ChartWindow(Pairs[k], PERIOD_H4); } for (k = 0; k < BUTTON_MAX; k++) { if(RunningTrades(Pairs[k]) ==0) guiEnable( hwnd, buttonCloseTrade[k],false); if (guiIsClicked(hwnd, buttonCloseTrade[k])) { if (MessageBox(Pairs[k]+", Close this trade? ", "Close Trade", MB_YESNO | MB_ICONQUESTION) != IDYES) return(1); CloseTrades(Pairs[k], maxSlippage(), MagicNumber); } } UpdateGrid(); }
Apologies for the formatting - the forum doesn't seem to like tab-indented code :\Code: Select all
void refreshGrid() { if ( showDisplay ) { //CreateGrid(); UpdateGrid(); } }