Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 722

 
SemenTalonov:

Returned value if no bar was found at the specified time. Whenexact=false iBarShift returns index of the nearest bar with open time less than specified (time_open<time). If such a bar is not found (no history before the specified time), the function will return -1.

But we have history, it is a fact. Everything happens at the newest (0-th bar by time series).

Is the timeseries ready when you access it?
 
Artyom Trishkin:
Is the timeseries ready when you address it?

Can she not be ready?

 
SemenTalonov:

Could she be unprepared?

Yes
 
Comments not relevant to this topic have been moved to "Features of mql5 language, intricacies and techniques".
 
Synchronisation of terminal data and server data

If OnTick() or OnCalculate() fails to get all required data, quit the event handler, expecting to get access to data when the handler is called next time.


It looks like this

 
Do you know if there is a script or an indicator on the website that shows breakeven level for two indicators? For example, I have a grid of orders, the price is at 1.2255 and I have a lot of open orders, but I need to find the breakeven level of two sell orders, breakeven level for two sell orders, for 1.3400, which is winning and for 1.2150, which is minus. Here, I need to find the breakeven level among them. Is there a script that should help me indicate 2 or 3 pending orders and the level 0 will be shown on the chart with consideration of lots, Martingale, if there is one?
 
I write like this:
void OnTick()
{
   double raznica=Close[30000];
   Alert(raznica);
}


There is an error in the tester:



Why?

 
multiplicator:
I write like this:

There is an error in the tester:

Why?

Because there is no bar with index 30000 on the chart and in the terminal

 
Vladimir Pastushak:

Because there is no 30000 bar on the chart and in the terminal

so how do i test it then?

the EA, when it starts, has to process 30,000 previous minutes.


I am testing an EA for 2018.

At launch, it should go through all of the previous month's minutes (this turns out to be the last month of 2017),
and use them to calculate dispersion coefficient.

There are as many as 30,000 minutes.


Can you take the next ones? Can the EA "look into the future"?
I need to calculate the variance, so I don't care whether the subsequent ones or the previous ones.
 
multiplicator:
can the EA "see into the future"?

cannot.

use iBars() to see the available history

HH: If I am not mistaken, in the tester, when you start the Expert Advisor is available 1000 bars, then with the generation of new data the number of bars will increase. The tester models the history of all the TFs to which it is addressed, ie, if you ran the test on H1 and during the test accessed the data in TF M1, then when you start you will be available for 1000 bars on H1 and therefore 60 * 1000 = 60,000 bars M1

you need to read articles like this oneat https://www.mql5.com/ru/articles/1511

Strategy Tester: режимы моделирования при тестировании торговых стратегий
Strategy Tester: режимы моделирования при тестировании торговых стратегий
  • www.mql5.com
Многие программы технического анализа позволяют проводить тестирование торговых стратегий на исторических данных. В большинстве случае тестирование идет по уже сформированным данным, без попыток моделирования движения внутри ценового бара. Получается быстро, но недостаточно точно. Для качественного тестирования торговой стратегии важно выбрать...