Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1263

 
Sunriser:

How can an EA in testing mode determine which ticks simulation mode is used in a test?

How canan EA distinguish between "OHLC on M1" and "Opening price only"?

I will answer my own question. Type of ticks modelling is printed in "Model"

https://www.mql5.com/ru/forum/318305/page12#comment_14176127

Библиотеки: MultiTester
Библиотеки: MultiTester
  • 2019.12.07
  • www.mql5.com
Статьи и техническая библиотека по автоматическому трейдингу: Библиотеки: MultiTester
 

Can you tell me how to get

FaceValue = ?

и

AccruedInterest = ?

These values are used in the pledge/profit calculation for

SYMBOL_CALC_MODE_EXCH_BONDS

SYMBOL_CALC_MODE_EXCH_BONDS_MOEX

in formulas

Margin: Lots * ContractSize * FaceValue * open_price * /100

Profit: Lots * close_price * FaceValue * Contract_Size + AccruedInterest * Lots * ContractSize

 

Good afternoon, may I ask about the tick arrival time generation algorithm for M1? Excerpt from the help.

Testing of strategies

  • OHLC on M1 - in this mode only 4 prices of each minute bar are simulated - prices Open, High, Low and Close.

In fact, OHLC prices are present in history data. Therefore, only arrival times of Open, High, Low and Close ticks are generated during testing, price values are taken from history.

 
SEM:

Good afternoon, may I ask about the tick arrival time generation algorithm for M1? Excerpt from the help.

Testing of strategies

  • OHLC on M1 - in this mode only 4 prices of each minute bar are simulated - prices Open, High, Low and Close.

In fact, OHLC prices are present in history data. Therefore, only arrival times of Open, High, Low and Close ticks are generated during testing, price values are taken from history.

Real and generated ticks

Реальные и сгенерированные тики - Алгоритмический трейдинг, торговые роботы - Справка по MetaTrader 5
Реальные и сгенерированные тики - Алгоритмический трейдинг, торговые роботы - Справка по MetaTrader 5
  • www.metatrader5.com
Для тестирования и оптимизации советников необходимы тики, так как именно по ним работает советник. Тестирование может осуществляться на реальных тиках, предоставляемых брокером, или же на тиках, сгенерированных тестером стратегий на основе минутных данных. Реальные тики # Тестирование и оптимизация на реальных тиках являются максимально...
 
Vladimir Karputov:

Real and generated tics

That's where I took the excerpt from the text. I am interested in how the ticks arrive (time of arrival, highlighted in bold)

 
SEM:

That's where I took the extract from the text. I am interested in how the ticks come (time of arrival, highlighted in bold)

In OHLC mode there are no ticks as such. Naturally, the time between four points is divided into four intervals.

To check: put Print in OntTick() and run in OHLC mode.

 

Hello. Can you give me a hint?

How do I check if the time is a trade time or not?

(for the EA to start working immediately, without waiting for the first tick)

 
Andrey Sokolov:

Hello. Can you give me a hint?

How do I check if the time is a trade time or not?

(for the Expert Advisor to start working immediately, without waiting for the first tick)

OnTimer()

but what kind of bids are you going to put in your orders?)

https://www.mql5.com/ru/docs/event_handlers/ontimer

i.e. the function in the EA will be triggered without the ticks coming in
Документация по MQL5: Обработка событий / OnTimer
Документация по MQL5: Обработка событий / OnTimer
  • www.mql5.com
//|                                               OnTimer_Sample.mq5 | //|                        Copyright 2018, MetaQuotes Software Corp. | //|                                             https://www.mql5.com | //| Expert initialization function                                   |...
 
dr.mr.mom:

OnTimer()

just what kind of bids will you put in the orders?)

https://www.mql5.com/ru/docs/event_handlers/ontimer

i.e. the function in the Expert Advisor will work without ticks coming in

This is not the question. The question is how to make the Expert Advisor start working, including trading, when the time is right, without waiting for a new tick.

 
Andrey Sokolov:

This is not the question. The question is how to make the Expert Advisor start working, including trading, when it is time to trade, without waiting for a new tick.

The Expert Advisor processes events. If you don't want to wait for the NewTick# event, which is handled by theOnTick function, you can use the

boolEventSetTimer(
int seconds// number of seconds
);

to generate events fromtimerwith specified periodicity, the Timer# event is handled by OnTimer() function. Your Expert Advisor will work continuously (with some periodicity) without waiting for the tick events.

Документация по MQL5: Программы MQL5 / События клиентского терминала
Документация по MQL5: Программы MQL5 / События клиентского терминала
  • www.mql5.com
Сразу же после того, как клиентский терминал загрузит программу (эксперт или пользовательский индикатор) и запустит процесс инициализации глобальных переменных, будет послано событие Init, которое обрабатывается функцией OnInit(), если она есть. Это событие также генерируется после смены финансового инструмента и/или периода графика, после...