Errors, bugs, questions - page 289

 
only logs - the re-rating will not affect the performance of the Expert Advisor
etc.

Here is the code in the EA (tried many functions to determine the equality of the indicator line 0)

I took the simplest one.

if (Sp3Buffer[20]!=0 && Sp3Buffer[21]!=0 && Sp3Buffer[22]!=0 && Sp3Buffer[23]!=0 && Sp3Buffer[24]!=0)

here we have the values of the indicator line here from the tester's log via print

[20]=34.40035703438407[21]=35.93782852396674[22]=35.97127995180715[23]=30.49164953708304[24]=32.90441573888087

there is no zero, but looking at the indicator - a clear zero - and in the values of

of the indicator is also zero.

what the hell?

 

This is the kind of nonsense that came up in the log after the update command was executed on the graph:

2011.02.03 02:24:51 HistoryBase '#IBM' 1 invalid bars removed
2011.02.03 02:24:50 HistoryBase '#IBM' 1 invalid bars removed
2011.02.03 02:24:49 HistoryBase '#IBM' 1 invalid bars removed
2011.02.03 02:24:48 HistoryBase '#IBM' 1 invalid bars removed
2011.02.03 02:24:47 HistoryBase '#IBM' 1 invalid bars removed
2011.02.03 02:24:46 HistoryBase '#IBM' 1 invalid bars removed

etc every second.

TF Sentry

 
alexluek:
only logs - the re-rating will not affect the performance of the Expert Advisor
etc.

Here is the code in the EA (tried many functions to determine the equality of the indicator line 0)

I took the simplest one.

here we have the values of the indicator line here from the tester's log via print

there is no zero, but looking at the indicator - a clear zero - and in the values of

of the indicator is also zero.

what the hell?

Have you forgotten to reverse the array?
 
sergey1294:
Have you forgotten to reverse the array?
The reverse order of indexing is set both in the indicator and in the Expert Advisor, but I don't know what's wrong. Thank you
 

Interesting, it turns out that the same Expert Advisor on different computers adds templates to the chart from different places:

on 1 computer from MetaTrader 5\Profiles\Templates

on 2 computer from MetaTrader 5\MQL5\Files

Adding line inChartApplyTemplate(handle_Chart, "Sova15_30.tpl")

What's up, who can help me figure it out?

 
Can you tell me how to get the time of the last position change?
 
beginner:

Can you tell me how to get the time of the last position change?
https://www.mql5.com/ru/articles/138 find myposition.Time() there
Как использовать торговые классы Стандартной библиотеки при написании советника
Как использовать торговые классы Стандартной библиотеки при написании советника
  • 2010.11.10
  • Samuel
  • www.mql5.com
В статье рассказывается о том, как использовать основной функционал торговых классов Стандартной библиотеки при написании советников, в которых применяется открытие, закрытие и модификация позиции, проверка свободной маржи перед размещением торговых ордеров, размещение и удаление отложенных ордеров. Показано, как использовать торговые классы для получения свойств ордеров и сделок.
 
beginner:

Can you tell me how to get the time of the last position change?

Determine which trade on the symbol was the last one.

You can either catch it in OnTrade() or in the history.

Trolls:
https://www.mql5.com/ru/articles/138 find myposition.Time() there

This is how the time of position opening is returned, if I remember correctly (i.e. as far as I understand it will return the time of the first trade that opened the position).

As for the mentioned article, myhistory and mydeal may be useful(maybe something else will fit).

 
Interesting:

Determine which trade on the symbol was the last one.

You can either catch it in OnTrade() or in the history.

This is how the time of position opening is returned, if I remember correctly (i.e., as far as I understand it, the time of the first trade, which opened the position, is returned).
Yes, this is the problem, i.e. we need to find the last trade for the required instrument and get its time, can you do it more simply?
 
beginner:
Yes, this is the problem, i.e. it is necessary to find the last deal for the required instrument and obtain its time, but in an easier way?

Are you interested in a specific position (symbol and its Id are known) or the general case for all positions?

If you just look through the history and analyze deals (using mydeal), then approximately so:

1. Get the total number of deals for the period, going through them, selecting only those for the symbol / or those that participated in the formation of the position

if (HistorySelect(0,TimeCurrent()))
ulong d_ticket; // deal ticket
{
// Получить общее количество сделок в истории
int tot_deals = HistoryDealsTotal();

  for(int j=0; j<tot_deals; j++)
  {
  d_ticket = HistoryDealGetTicket(j);

    if(d_ticket>0)  
    {
    mydeal.Ticket(d_ticket)

      if(mydeal.Symbol()==SymbolTitle)
      {
      //формируем список сделок и анализируем его (если я правильно понял последняя сделка наша)
      }

    }   

  }

}

2. it is better to select deals not by symbol, but by ID of a specific position (it's easier and more reliable).

Although I am sure there are more correct and simple solutions.

Reason: