Features of the mql5 language, subtleties and tricks - page 72

 

The MqlRates.spread field contains the minimum spread value per bar. This is a complete foolishness for a backtest. Everyone can correct it through the custom symbols as follows

spread = LowAsk - LowBid; // условный код - не показывает обработку некоторых нюансов

With such a spread, the Expert Advisors are wonderfully (in terms of quality and speed) tested in the mode "by opening prices" on the same Limit orders.

 

Running a test agent with the ability to use the FILE_COMMON folder and OpenCL:

metatester64.exe /local /password:tester /address:0.0.0.0:2000
 
 

The main advantage of MT4 is its intuitiveness and simplicity in program code
No need to pre-define what you want to do, there are built-in arrays like


iTime("USDCHF",PERIOD_H1,0),","," iOpen("USDCHF",PERIOD_H1,0),",
iHigh("USDCHF",PERIOD_H1,0),", ", iLow("USDCHF",PERIOD_H1,0),",
iClose("USDCHF",PERIOD_H1,0),", ", iVolume("USDCHF",PERIOD_H1,0);


There are a lot of classes and libraries for MT5

Is it so impossible to make a few such classes and libraries, which allow to program in MT5, as it is done in MT4?
 
Stefan Stoyanov:

The main advantage of MT4 is its intuitiveness and simplicity in program code
No need to pre-define what you want to do, there are built-in arrays like


iTime("USDCHF",PERIOD_H1,0),","," iOpen("USDCHF",PERIOD_H1,0),",
iHigh("USDCHF",PERIOD_H1,0),", ", iLow("USDCHF",PERIOD_H1,0),",
iClose("USDCHF",PERIOD_H1,0),", ", iVolume("USDCHF",PERIOD_H1,0));


There are a lot of classes and libraries for MT5

Is it so impossible to make some of these classes and libraries which allow to program in MT5 as it is done in MT4

There are a lot of libraries, which allow in mt5 to write code exactly as they were written in mt4.

 
Stefan Stoyanov:

Is it so impossible to make some classes and libraries that allow to program in MT5 as it is done in MT4?

When fxsaber leaves, ask him to write a library so that you can write as in mql3, and then you can not write at all. Don't you think it's time to grow up?

 

How do I know the terminal time, I need to figure out the shift in the clock between the terminal, and the local?

There's TimeGMTOffset(), but it's really useless.

Right now the terminal shows 23:58, the local shows 16:54. But we need to find out what shift the terminal is running on GMT. Monday through Friday you can find out with a tambourine.

Looking forward to the answers, Thanks!

 
Vitaly Muzichenko:

How do I know the terminal time, I need to figure out the shift in the clock between the terminal, and the local?

There's TimeGMTOffset(), but it's really useless.

Right now the terminal shows 23:58, the local shows 16:54. But we need to find out what shift the terminal is running on GMT. Monday through Friday can be found out with a tambourine.

I am waiting for answers, Thanks!

The terminal in the market overview shows the arrival time of the last tick of the broker's server by the broker's time.

You can compare the closing price of the instrument's candles at an unknown broker with the closing time of the same candles at a known broker.

Calculate the time difference.

 
Kirill Belousov:

The terminal in the market overview shows the arrival time of the last tick of the broker's server according to the broker's time.

You can compare the closing price of the instrument's candles at an unknown broker with the closing time of the same candles at a known broker.

Calculate the time difference.

But this way the candlesticks will show the server's time as well.

Suppose, now I start the terminal from any dealer, there are no quotes, but there is the last recorded inthe market review at 23:58, but with what shift in GMT it works - do not know.

Or am I already dumb, and it can be found out very simply?

P.S. Suppose I got lost in time and stopped distinguishing between day/night, days of the week, time.

How to find out that there are no quotes because it's a weekend, or for example on Thursday no quotes, because the server hangs in the dealing room?

I see such a solution, but I don't see how to implement it without having a trading server at hand:

if( TimeCurrent()<TimeServer()+60 ) return( "нет котировок уже 1 минуту" );
 
Vitaly Muzichenko:

But this way the candlesticks will also show the server time.

Suppose, now started the terminal from any dealing, no quotes, but there is the last recorded inthe market overview 23:58, but with what shift GMT it works - do not know.

Or am I already dumb, and it can be found out very simply?

P.S. Suppose I got lost in time and stopped distinguishing between day/night, days of the week, time.

How to find out that there are no quotes because it is a weekend, or for example on Thursday there are no quotes, because the server hangs in the dealing room?

At the closing price find a candle in an independent brokerage company on the history, at which you know the GMTOffset. The difference between the candlesticks time will give the difference between the brokerage companies. Add to the difference the GMT of the known one and get the GMT difference of the unknown one.

You never know the time of trade server. You only know the time of arrival of the last quotation for the instrument.

It's more convenient to use just the hourly candlesticks.

Reason: