Errors, bugs, questions - page 1967

 
Комбинатор:
It's OK if you can get it to compile and run in the pros )

I don't really understand what's wrong with it. Everything works.

template<typename T>
void f() { }

template<>
void f<int>() { }

int _tmain(int argc, _TCHAR* argv[])
{
  f<double>();
  f<int>();

  return 0;
}
 
Alexey Navoykov:

I don't really understand what's wrong with it. Everything works.

Okay, I'm the stupid one.
 

Forum on trading, automated trading systems and trading strategy testing

Bugs, bugs, questions

A100, 2017.08.17 18:45

template <typename T>
int xxx::value = -1;

Yes, that's something I've already discovered. But the problem is (was) that in the source this memeber is actually an array, and I decided to deal with the scalar first for simplicity. However, for the array the same trick doesn't work. I had to drag the array statically inside the member function.

 
Stanislav Korotky:

However, the same trick doesn't work for an array. I had to drag the array statically inside the member function.

This is already a compiler error - we should tell Service Desk

template<typename T>
struct A {
        static int i[];
};
template<typename T>
int A::i[]; //error: '[' - unexpected token
 

build 1650. If several related .ex5 modules (main and library), nothing works at all. Everywhere there is an error of the form:

2017.08.18 01:49:59.759 Draw (USDJPY,H1) Cannot find 'xxx' in 'yyyy.ex5'

Everything was working fine before. Even now, when compiling MetaEditor 1646 + MetaTrader 1650, everything works

Obviously there is an error in MetaEditor 1650, while .ex5 files are almost twice as thin. Why such experiments?

 

Adding code

//Test.mqh
class A {};
class B { public:
        B() { f(); }
        A *g() { return NULL; }
void f()
{
        void *x = g();
        if ( true )
                return; 
        delete x; //в build 1650 не работает даже если до delete никогда (!) не доходит
                   //а ошибка при выполнении возникает именно из-за наличия этой строки
                   //и указатель в исходном коде действительный (есть проверка)
}
};

//Test.mq5
#include "Test.mqh"
#import "Test2.ex5"
        A *f();
#import
void OnStart()
{
        f();
}
//Test2.mq5
#property library
#include "Test.mqh"
static B b;
A *f() export { return NULL; }

The result is in the previous post

 
Another example to check
//Test.mq5
class A;
#import "Test2.ex5"
        A *f();
        void g( A* );
#import
void OnStart() //вариант 1
{
        f(); /*возвращаемое значение не используется*/
}
//Test2.mq5
#property library
class A {};
static A *a;
A *f()       export { /*делает что-то полезное*/; return a; }

void g( A* ) export { /*делает что-то полезное*/; }

The library is general in nature. By the way, the returned f() pointer is not used in this case - option 1 (but can be used - see option 2 below). When compiling Test.mq5 there are no error messages - it means the compiler doesn't need to define the class (A). Nevertheless, there is an error during execution: Cannot find 'f' in 'Test2.ex5'.

Further on

void OnStart() //вариант 2
{
        g( f()/*возвращаемое значение используется*/);
}
 
Can you tell me if it is possible to set the relative drawdown instead of the maximum drawdown in the test results? But often the maximal drawdown is 3-5% and relative drawdown reaches 50%. And to see the relative drawdown should be tested separately. Thanks in advance
Тестирование стратегий - Алгоритмический трейдинг, торговые роботы - Справка по MetaTrader 5
Тестирование стратегий - Алгоритмический трейдинг, торговые роботы - Справка по MetaTrader 5
  • www.metatrader5.com
Тестер стратегий позволяет тестировать и оптимизировать торговые стратегии ( советники ) перед началом использования их в реальной торговле. При...
 
 
Vladimir Pastushak:

The Windows language needs to be changed to be happy...

Reason: