Errors, bugs, questions - page 2816

 
fxsaber:

I remember that when I was into this subject, there were many nuances. Something showed right or wrong, depending on the OnTester* function. Try to call it in different On-functions.

What do you mean different? I need it in OnTesterInit - there are no other options.

 
Stanislav Korotky:

What do you mean different? I need it in OnTesterInit - no other options.

Forum on trading, automated trading systems and strategy testing

Bugs, bugs, questions

fxsaber, 2017.08.15 17:49

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:

This only confirms my test case: setting a parameter in MQL has no effect on its subsequent reading in OnTesterInit. In the other handlers, it's too late to adjust anything, as the passes are determined by the initial settings.

 
Shortcoming
#import "z.ex5" //(1) Error: '#import' - #import was not closed
#import
/*
.
.
.
*/
#import "z.ex5" //(2)

The 2nd #import is not closed, but the error is on the 1st one - therefore the real error location is shown incorrectly - it took me a long time to figure out what was wrong

 
Compilation error:
class A {};
class B {
public:
    static A a;
} b;  //Error: unresolved static variable 'B::a'
A B::a;
void OnStart() {}
 
 

Function:

CopyTicksRange(_Symbol, _ticks, COPY_TICKS_ALL);

in tick generation mode returns a maximum of 131072 ticks. Is this a bug, a feature, does the documentation say anything about this?

In real ticks mode, there is no such limitation.

 
Comments not related to this topic have been moved to "Questions from MQL4 MT4 MetaTrader 4 beginners".
 
Is the current behaviour correct when the Expert Advisor in frame mode on the Terminal chart is run with the default input parameters rather than those set in the Tester Parameter tab?
 
Is it possible to protect the chart from timeframe and symbol changes ?