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

 
Aleksei Stepanenko MqlDateTime structure. But in this case, there will be signals of missed bars that should not exist.

For example:

Missed 1 bar on Wednesday, started by this symbol at 00:30, i.e. lost at 00:00

M30 time frame, it turned out to be 47 in a day instead of 48. This is exactly what we need to identify


 
Vitaly Muzichenko #:

Here is an example:

Missed 1 bar on Wednesday, started by this symbol at 00:30, i.e. lost at 00:00

M30 time frame, got 47 in the day instead of 48. This is exactly what we need to identify.


I do not know the right way, but I would think in this direction

      datetime tt=Time[Bars-1];
      //--- 
      if(Time[i]==tt){tt+=PeriodSeconds(PERIOD_CURRENT);}
      else
      {Print(TimeToString(tt,TIME_DATE|TIME_MINUTES));tt+=PeriodSeconds(PERIOD_CURRENT);}
 
Vitaly Muzichenko #:

Here is an example:

Missed 1 bar on Wednesday, started by this symbol at 00:30, i.e. lost at 00:00

M30 time frame, got 47 in the day instead of 48. This is exactly what we need to identify


int  Bars( 
   string           symbol_name,     // имя символа 
   ENUM_TIMEFRAMES  timeframe,       // период 
   datetime         start_time,      // с какой даты 
   datetime         stop_time        // по какую дату 
   );
If 47
 

Vitaly Muzichenko #:

That's exactly what we need to identify.

Got it, the question is false alarms, of which there will be many.

//дата последней свечи
 curr_time=iTime(symbol,frame,0);
//ограничение на торговлю вне начала бара
if(last_time==curr_time) return;

if((iBarShift(eSymbol,eFrame,last_time)-iBarShift(eSymbol,eFrame,curr_time))>PeriodSeconds(eFrame)) printf("а-я-яй");
last_time=curr_time;
 
Alexey Viktorov #:
If 47

This is possible, you can also CopyOpen()

Can't decide how to organise this in a loop through the whole story

 

even simpler:

for(int i=TotalBars-1; .....
   {
   if((iBarShift(eSymbol,eFrame,last_time)-i)>PeriodSeconds(eFrame)) printf("а-я-яй");
   last_time=iTime(symbol,frame,i);
 
Vitaly Muzichenko #:

This is possible, you can also CopyOpen()

Can't decide how to organise this in a loop through the whole story

The opening time of the zero day bar minus 1 second to the opening of the first day bar. Then from the opening of the first daily bar minus 1 second to the opening of the second daily bar and so on.
 
Vitaly Muzichenko #:

This is possible, you can also CopyOpen()

I can't decide how to arrange it in a loop over the whole history

Exactly (for example for M30) - if time between openings (modulo % 24 hours) of neighbouring bars is longer than M30 - it means that there are bars missing between them.

int nbars = ( ( iTime(_Symbol,PERIOD_M30,N) - iTime(_Symbol,PERIOD_M30,N+1) ) ) / PeriodSeconds(PERIOD_M30) ) % 48; // сколько баров должно быть между ссоедними отметками

if (nbars>1) PrintFormat("Пропущено баров: %d",nbars-1);

 

Thank you all, the principle is clear, the problem has been formalised.

---

Now a question: What am I doing wrong, all characters have the same value?

#property strict

//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
   Print( DoubleToString(SymbolInfoDouble(_Symbol,SYMBOL_POINT),8) );
  }
//+------------------------------------------------------------------+
0       14:39:38.965    sc GBPCHF,M30: 0.00001000
0       14:46:44.478    sc NZDCHF,M30: 0.00001000
0       14:44:54.709    sc EURUSD,M30: 0.00001000

---

P.S. Terminal MT4, checked on two different terminals in different brokerage companies

P.SS. I checked in MT5, the result is the same

2021.11.20 15:05:34.881 sc (EURCHF,M30)  0.00001000
2021.11.20 15:05:39.203 sc (AUDUSD,M30)  0.00001000
2021.11.20 15:05:51.985 sc (EURAUD,M30)  0.00001000

---

I am probably doing something wrong!

I need to get "Point value"

 
Vitaly Muzichenko #:

Thank you all, the principle is clear, the problem has been formalised.

---

Now a question: What am I doing wrong, all characters have the same value?

Vitaly, here it is necessary to either bug the developers, or