MetaTrader 4 Build 600 with Updated MQL4 Language and Market of Applications Released - page 11

 
Ooh shiny .. parameterized macros in the preprocessor ...
 

The OnInit() / Init() appears to be unreliable on both 600/602.

Having several different EA's installed over multiple pairs/charts (I tried on 6), some functions within the Initialization loop are left out/not returning correct values. This error is repeatable, and the init loop on all the EAs is identical.

E.g. MarketInfo(Symbol(),MODE_LOTSTEP), Digits...

All EAs were updated to the new MQL Structure already...

This error depends on sequence. 1st chart/2nd chart etc.

 
yokinfx:

Just a question: Will it be available in the near future multi-currency backtesting for MetaTrader4?


No. Sorry
 

Raptor - here are the requested images:-

http://i62.tinypic.com/2dbqwb4.jpg

http://i61.tinypic.com/whdwy9.jpg

 

I have noticed some bugs in the compiler. It sometimes shows wrong line numbers in the include files, so that the error is very hard to find, but I also doubt that there is an error at all, because one error has been eliminated by removing an unused variable and this shouldn't generate any error.

The error shows this:

C:\Program Files (x86)\ForexClub MT4\MQL4\include\mtp_add\offlinechart.mqh(3,4) : error 116: 'FileWriteInteger' - declaration without type
C:\Program Files (x86)\ForexClub MT4\MQL4\include\mtp_add\offlinechart.mqh(4,4) : error 116: 'FileWriteArray' - declaration without type
C:\Program Files (x86)\ForexClub MT4\MQL4\include\mtp_add\offlinechart.mqh(4,68) : error 116: 'FileFlush' - declaration without type
C:\Program Files (x86)\ForexClub MT4\MQL4\include\mtp_add\offlinechart.mqh(4,93) : error 175: 'return' - expressions are not allowed on a global scope
C:\Program Files (x86)\ForexClub MT4\MQL4\include\mtp_add\offlinechart.mqh(4,104) : error 175: '}' - expressions are not allowed on a global scope

And the included file it refers to:

#include <lib\WinUser32.mqh>

#define CHART_CMD_UPDATE_DATA 33324

bool logchartmaking = false;

int get_offline_chart_hwnd(int chart_timeframe_name)
{
return(WindowHandle(Symbol(), chart_timeframe_name));
}

int OpenHistoryFile(int& FileHandle, string chart_timeframe_name, bool onlywrite = false)
{
string name;
name = Symbol() + chart_timeframe_name;
Print("name=",name);
if (onlywrite) FileHandle = FileOpenHistory(name + ".hst", FILE_BIN|FILE_WRITE);
else FileHandle = FileOpenHistory(name + ".hst", FILE_BIN|FILE_READ|FILE_WRITE);
if (FileHandle < 0) return(-1);
return (0);
}

void CloseHistoryFile(int FileHandle)
{
if (FileHandle >= 0) FileClose(FileHandle);
}

int WriteHistoryHeader(int FileHandle, int chart_timeframe_name)
{
string c_copyright;
int i_digits = Digits;
int i_unused[13] = {0};
int version = 400;

if (FileHandle < 0) return (-1);
c_copyright = "(C)opyright 2003, MetaQuotes Software Corp.";
FileWriteInteger(FileHandle, version, LONG_VALUE);
FileWriteString(FileHandle, c_copyright, 64);
FileWriteString(FileHandle, Symbol(), 12);
FileWriteInteger(FileHandle, chart_timeframe_name, LONG_VALUE);
FileWriteInteger(FileHandle, i_digits, LONG_VALUE);
FileWriteInteger(FileHandle, 0, LONG_VALUE); //timesign
FileWriteInteger(FileHandle, 0, LONG_VALUE); //last_sync
FileWriteArray(FileHandle, i_unused, 0, ArraySize(i_unused));
FileFlush(FileHandle);
return (0);
}

void WriteHistoryData(int FileHandle, int i_time, double d_open, double d_low, double d_high, double d_close, double d_volume, int write_to_bar=EMPTY_VALUE)
{

if (FileHandle >= 0) {
if (write_to_bar < 1) {
FileSeek(FileHandle,-(5*DOUBLE_VALUE+LONG_VALUE),SEEK_END);
} else {
FileSeek(FileHandle,0,SEEK_END);
}

if (logchartmaking) Print("Handle:",FileHandle," pos:",FileTell(FileHandle)," time:",TimeToStr(i_time,TIME_DATE|TIME_MINUTES|TIME_SECONDS)," open:",d_open," low:",d_low," high:",d_high," close:",d_close," volume:",d_volume," write to bar:",write_to_bar);

FileWriteInteger(FileHandle, i_time, LONG_VALUE);
FileWriteDouble(FileHandle, d_open, DOUBLE_VALUE);
FileWriteDouble(FileHandle, d_low, DOUBLE_VALUE);
FileWriteDouble(FileHandle, d_high, DOUBLE_VALUE);
FileWriteDouble(FileHandle, d_close, DOUBLE_VALUE);
FileWriteDouble(FileHandle, d_volume, DOUBLE_VALUE);
}
}

int UpdateChartWindow(int hwnd, int FileHandle)
{
if(hwnd!= 0) {
FileFlush(FileHandle);
if (IsDllsAllowed() == false) {
//DLL calls must be allowed
//DebugMsg("Dll calls must be allowed");
return (-1);
}
if (PostMessageA(hwnd,WM_COMMAND,CHART_CMD_UPDATE_DATA,0) == 0) {
//PostMessage failed, chart window closed
hwnd = 0;
} else {
send_fake_tick(hwnd);
//PostMessage succeed
return (0);
}
}
}


This was included by the main program on top:

#property copyright "Zoltan Laszlo Ferenci"
#property link "http://www.metatraderprogrammer.com"

#include <mtp_core\eafunctions.mqh>
#include <mtp_add\offlinechart.mqh>
#include <mtp_add\timefunctions.mqh>
#include <mtp_core\objectfunctions.mqh>
#include <mtp_core\strfunctions.mqh>
#include <lib\WinUser32.mqh>


If someone from MetaQuotes development team is interested, I can send the full code in a private email. It has been working in MT4 quite well.

 

Hi there

I have an indicator which is not compiling after the new build. Can anyone help?

Files:
alerters2.mq4  76 kb
 
Folex:

The OnInit() / Init() appears to be unreliable on both 600/602.

Having several different EA's installed over multiple pairs/charts (I tried on 6), some functions within the Initialization loop are left out/not returning correct values. This error is repeatable, and the init loop on all the EAs is identical.

E.g. MarketInfo(Symbol(),MODE_LOTSTEP), Digits...

All EAs were updated to the new MQL Structure already...

This error depends on sequence. 1st chart/2nd chart etc.

Can you post how to repeat it please ?
 

Hi:

I'm trying to find a way to handle the warning I'm getting for the piece of code provided. This "Lookup Filter" (found it here on this forum and it worked without any problems in the OLD builds), is being used numerous times (all over) in my EA. Are there any of you who may suggest some solution or a way to tackle this?

The warning I'm getting is: "Check operator precedence for possible error; use parentheses to clarify precedence"

I thank you very much
for (int cnt = OrdersTotal() - 1; cnt >= 0; cnt--) {
      
      if (OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES)   
        &&  OrderMagicNumber()  != MagicNumberC1 
        &&  OrderMagicNumber()  != MagicNumberC2 
        &&  OrderMagicNumber()  != MagicNumberC3            
        ||  OrderSymbol()       != Symbol()                 
        ||  OrderType()         >  OP_SELL
        ||  OrderOpenTime()     <  Begin) continue;
      
      if (OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES)   
        &&  OrderMagicNumber()  == MagicNumberC1 
        ||  OrderMagicNumber()  == MagicNumberC2 
        ||  OrderMagicNumber()  == MagicNumberC3            
        &&  OrderSymbol()       == Symbol()                 
        &&  OrderType()         <= OP_SELL
        &&  OrderOpenTime()     >= Begin){


 
angevoyageur:
Can you post how to repeat it please ?

Sure,

I used the attached EA, just copied it 2 times and renamed in test2 and test3. Thus all are identical in their code, just the name differs.

MT4 Build 602 has been used.

test1 to be attached to EURUSD/GBPUSD/USDJPY/AUDUSD respectively the first four charts and in sequence.

test2 to be attached to GBPUSD which is chart number 5 in sequence.

test3 to be attached ti AUDUSD which is chart number 6 in sequence.

While attaching them to the charts, the results are correct as per below log:

15:15:56 Expert test1 EURUSD,H1: loaded successfully

15:15:58 test1 EURUSD,H1: Initialization Values: Digits = 5 / LotStep = 0.01

15:15:58 test1 EURUSD,H1: initialized

15:16:01 Expert test1 GBPUSD,H1: loaded successfully

15:16:02 test1 GBPUSD,H1: Initialization Values: Digits = 5 / LotStep = 0.01

15:16:02 test1 GBPUSD,H1: initialized

15:16:05 Expert test1 USDJPY,H1: loaded successfully

15:16:06 test1 USDJPY,H1: Initialization Values: Digits = 3 / LotStep = 0.01

15:16:06 test1 USDJPY,H1: initialized

15:16:09 Expert test1 AUDUSD,H1: loaded successfully

15:16:10 test1 AUDUSD,H1: Initialization Values: Digits = 5 / LotStep = 0.01

15:16:10 test1 AUDUSD,H1: initialized

15:16:17 Expert test2 GBPUSD,H1: loaded successfully

15:16:19 test2 GBPUSD,H1: Initialization Values: Digits = 5 / LotStep = 0.01

15:16:19 test2 GBPUSD,H1: initialized

15:16:21 Expert test3 AUDUSD,H1: loaded successfully

15:16:23 test3 AUDUSD,H1: Initialization Values: Digits = 5 / LotStep = 0.01

15:16:23 test3 AUDUSD,H1: initialized

After a restart of MT4 the results of test2 and test3 are incorrect as per below log:

15:16:52 test2 GBPUSD,H1: Initialization Values: Digits = 4 / LotStep = 0

15:16:52 test2 GBPUSD,H1: initialized

15:16:52 Expert test3 AUDUSD,H1: loaded successfully

15:16:52 test3 AUDUSD,H1: Initialization Values: Digits = 4 / LotStep = 0

15:16:52 test3 AUDUSD,H1: initialized

15:16:56 test1 USDJPY,H1: Initialization Values: Digits = 3 / LotStep = 0.01

15:16:56 test1 USDJPY,H1: initialized

15:16:56 test1 AUDUSD,H1: Initialization Values: Digits = 5 / LotStep = 0.01

15:16:56 test1 AUDUSD,H1: initialized

15:16:56 test1 EURUSD,H1: Initialization Values: Digits = 5 / LotStep = 0.01

15:16:56 test1 EURUSD,H1: initialized

15:16:56 test1 GBPUSD,H1: Initialization Values: Digits = 5 / LotStep = 0.01

15:16:56 test1 GBPUSD,H1: initialized

This error does repeat each time MT4 is restarted.

If you move the GBPUSD chart with test2 attached to first in sequence of the charts... the error will jump to test1... and so on...

Files:
test1.mq4  2 kb
 
stringo:
No. Sorry


That's a pity... I encourage MQ to achieve this: backtesting multicurrency. If MT4 had this feature, it would have no peer! MT4 is now the best platform IMHO ever, but it still lacks multicurrency BT...


RaptorUK:
Do you have any .set files in Users\myuser\AppData\Roaming\MetaQuotes\Terminal\[Long ID]\MQL4\Presets ?


There is nothing under this folder, it is empty.



Yesterday something strange happened to me after upgrading. I noticed my computer was terribly slow, so I saw that MetaTrader was consuming more than half of my CPU, so I aborted the process, because I could not exit MT4 normally, it didn't do anything so it seemed it was hanged. But it was not hanged, it was upgrading! When I started again my terminal, it tried to continue with the upgrading process. UAC messages (I have Windows 8.1) emerged about... don't know... 10 times? 15? Every time I accepted the UAC control, but it kept emerging all the time.

I had to restart my computer. After restarting, when I launched MT4, configuration of everything was lost: it didn't have *.srv files, it didn't have the config of the accounts, so I had to search for my broker in order to let MT4 search for the servers, and then create another DEMO account in one of the servers found.

So, just to resume: if you interrupt the upgrading process, you can lose "things" -still don't know the things you lose, but for what happened to me yesterday, A LOT.

Reason: