Errors, bugs, questions - page 1960

 
Case where DEAL_TIME_MSC returns zero
// Время в миллисекундах первой балансовой сделки (DEAL_TIME_MSC) в тестере равно нулю
int OnInit()
{
  if (HistorySelect(0, TimeCurrent()) && HistoryDealsTotal())
  {
    Print((datetime)HistoryDealGetInteger(HistoryDealGetTicket(0), DEAL_TIME)); // Время балансовой сделки
    Print(HistoryDealGetInteger(HistoryDealGetTicket(0), DEAL_TIME_MSC));       // Это же время в мс равно нулю
  }

  return(INIT_FAILED);
}
 

If you press Stop during optimisation and then restart Optimisation, it will not go, as this will be the entry

Core 1  occupied by another terminal
Core 2  occupied by another terminal
 
The tester does not call ParameterSetRange for input parameters that are not checked for Optimisation. For this reason ParametersGetRange returns zeros for the corresponding Start, Step and Stop values. This is not correct at all. For example, because of this, it is impossible to generate a complete SET file of the tester itself or to correct the Optimisation range of an input parameter if it is incorrectly set by the user.
 
ParameterGetRange does not work in OnTesterInit.
sinput int Range = 5;

#define  PRINT(A) Print(#A + " = " + (string)(A));

void PrintParameter( const string Name, const string From )
{
  PRINT(From)
  
  bool Enable;
  long Value, Start, Step, Stop;
  
  if (ParameterGetRange(Name, Enable, Value, Start, Step, Stop))
  {
    PRINT(Start)
    PRINT(Step)
    PRINT(Stop)
    PRINT(Value)
    PRINT(Enable)
  }   
}

void OnTesterInit()
{
  ParameterSetRange("Range", true, 5, 1, 2, 3); // Задали ненулевыми все значения
  
  PrintParameter("Range", __FUNCTION__); // Возвращает одни нули
}

void OnTesterDeinit()
{
  PrintParameter("Range", __FUNCTION__); // Работает нормально
  
  ChartClose();
}

void OnTesterPass()
{
  PrintParameter("Range", __FUNCTION__); // Работает нормально
}

int OnInit()
{
  uchar Data[];
  
  FrameAdd(NULL, 0, 0, Data);
  
  return(INIT_FAILED);
}
 
fxsaber:
How to quickly add up many strings (e.g. generate a trade report in string)

Result

There is a fact marked in red which cannot be explained in any way.

The peculiarity of the memory pool, the first call SumString2 in the memory pool is "saturated" with memory from the system, the second time, the memory is no longer requested from the system.

I recommend correcting SumString1

ulong SumString1( string TmpStr, const int Amount )
{
  const ulong StartTime = GetMicrosecondCount();

  string Str;
  StringInit(Str,Amount * StringLen(TmpStr) + 1);            << обеспечим строке приёмный буфер

  for (int i = 0; i < Amount; i++)
    Str += TmpStr;

  return(GetMicrosecondCount() - StartTime);
}
 
fxsaber:

On the editor.

  • If you type the following line in the Metaeditor, the tooltip (or what is the correct name for a tooltip with options?) GetMicrosecondCount does not appear.
    DoubleToString(GetMicro

The highlighting is clever, the DoubleToString argument should be double andGetMicrosecondCount should be ulong.

It would work like this:

DoubleToString( (double)GetMicro
 
fxsaber:

Any idea how to get the name of an arbitrary input parameter as a string?

input double dParam1 = 1.0; // Double
input int iParam2 = 2;      // Integer

Print( InputToString( dParam1 ) ); // "dParam1"
Print( InputToString( iParam2 ) ); // "iParam2"

template<typename T>
string InputToString(T param)
{
   ???
}
 
Andrey Khatimlianskii:

Any idea how to get the name of an arbitrary input parameter as a string?

input double dParam1 = 1.0; // Double
input int iParam2 = 2;      // Integer

#define  TOSTRING(A) (#A)

Print( TOSTRING( dParam1 ) ); // "dParam1"
Print( TOSTRING( iParam2 ) ); // "iParam2"
 
fxsaber:

Great, thanks!

And to get a list of EA instances when running a single tester run? Without reading settings file using dll.
Made a convenient display of parameters used in test after optimization (via file and main variables), one inconvenience remains - all parameters have to be listed manually.

 
Andrey Khatimlianskii:

Do I get a list of EA instances when running a single tester run?

You can not, only in the Optimization mode.

Forum on trading, automated trading systems and trading strategy testing

Bugs, bugs, questions

fxsaber, 2017.07.25 11:27

How to know the input parameters of an EA at least in single run mode?

For indicators there is IndicatorParameters.

For optimizations there is FrameInputs.

But for single run of the EA or normal run - nothing.