Libraries: MultiTester - page 50

 
fxsaber

Why 30 and not 31? The title seems to be calculated for 31 days.

uint Buffer[ 64 + 12 * 30 ];

What if it's crypto?

 
Stanislav Korotky #:

Why 30 and not 31? The headline seems to be for 31 days.

Indexes from 0 to 30 are 31.

 
fxsaber #:

The indices from 0 to 30 are 31 pieces.

Exactly, from 0 to 30, inclusive - a total of 31.

 
Stanislav Korotky #:

Exactly, 0 to 30, inclusive - 31 in total.

So you got that right?

 
fxsaber #:

So you got it right?

No. In the file header, as far as I can see, the array for 31 days is reserved, which is logical. So it should be 12*31 in the code. Where am I wrong?

Or provide a link to the tkc format description, where it says that there should be (maximum) 30 days in a month.

 
Stanislav Korotky #:

No. The file header, as far as I can see, reserves an array for 31 days, which makes sense.

I don't have any information on the header. Was doing a custom character and looking at which bytes were being changed. Only from those actions did I realise what certain bytes in the header are responsible for.

So it should be 12*31 in the code. Where am I wrong?

Or provide a link to the tkc format description where it says there should be (at most) 30 days in a month.

      uint Buffer[64 + 12 * 30];
      uint Read;

      kernel32::ReadFile(handle, Buffer, sizeof(Buffer), Read, 0);

      if (Read == sizeof(Buffer))
        for (int i = 63; i < (sizeof(Buffer) >> 2); i += 12)
          Res += (int)Buffer[i];

The variable i takes 31 values.

 
fxsaber #:

I don't have any information on the header. I made a custom symbol and watched which bytes were changed. Only from these actions I realised what certain bytes in the header are responsible for.

The variable i takes 31 values.

Clearly, the loop counts from 63, but when describing the array, 64 is allocated for the header, which is equivalent to the loop starting from -1. Not very intuitive, but the maths fits.

 
fxsaber #:
Obtain the number of ticks in a calendar month in a non-standard way.

Get information about available historical ticks by symbols.

#include <fxsaber\MultiTester\MTTester.mqh> // https://www.mql5.com/en/code/26132

string NumToString( ulong Num, const string Delimeter = " " )
{
  string Res = (Num ? NULL : "0");

  while (Num)
  {
    Res = ((Num < 1000) ? (string)(Num % 1000) : ::IntegerToString(Num % 1000, 3, '0')) +
          ((Res == NULL) ? NULL : Delimeter) + Res;

    Num /= 1000;
  }

  return(Res);
}

string TicksDataToString( const string Symb )
{
  datetime From = 0;
  datetime To;
  
  const int Amount = MTTESTER::GetAmountFileTicks(From, To, Symb);
  const string SizeStr = ::DoubleToString((long)Amount * sizeof(MqlTick) / (double)(1 << 20), 3) + " MB";
  
  return(Symb + ": " + NumToString(Amount) +" ticks (MqlTick[] = " + SizeStr + ")" +
         (From ? ", " + ::TimeToString(From) + " - " + ::TimeToString(To) +
                 ", " + GetDiffTime(From, To) // https://www.mql5.com/ru/forum/170952/page308#comment_57872629
               : NULL));  
}

void OnStart()
{
  const int Size = SymbolsTotal(true);
  
  for (int i = 0; i < Size; i++)
    Print(IntegerToString(i + 1, 3, '0') + "/" + IntegerToString(Size, 3, '0') +
          ". " + TicksDataToString(SymbolName(i, true)));
}


Result.

001/045. EURUSD: 473 689 648 ticks (MqlTick[] = 27104.739 MB), 2011.12.01 00:00 - 2025.09.01 00:00, 13 Years 9 Months
002/045. GBPUSD: 508 981 458 ticks (MqlTick[] = 29124.153 MB), 2011.12.01 00:00 - 2025.01.01 00:00, 13 Years 1 Months
003/045. USDCAD: 402 756 151 ticks (MqlTick[] = 23045.892 MB), 2011.12.01 00:00 - 2025.01.01 00:00, 13 Years 1 Months
004/045. USDCHF: 353 129 808 ticks (MqlTick[] = 20206.250 MB), 2011.12.01 00:00 - 2025.01.01 00:00, 13 Years 1 Months
005/045. USDJPY: 482 177 651 ticks (MqlTick[] = 27590.427 MB), 2011.12.01 00:00 - 2025.01.01 00:00, 13 Years 1 Months
006/045. AUDCAD: 446 882 461 ticks (MqlTick[] = 25570.820 MB), 2011.12.01 00:00 - 2025.01.01 00:00, 13 Years 1 Months
007/045. AUDCHF: 387 336 224 ticks (MqlTick[] = 22163.557 MB), 2011.12.01 00:00 - 2025.01.01 00:00, 13 Years 1 Months


You can see the cause of error 4004.

 
MTTester.mqh doesn't compile. I assume it's because of the recent MT5 build where there are quite a few things that all of a sudden don't compile anymore. Any chance you could provide an updated version of that library? It seems like an amazing library.
 
Goesta Torsten Hulden #:
MTTester.mqh is not compiled.

Up-to-date version only on the Russian-language page of the library.