Errors, bugs, questions - page 1853

 
Комбинатор:

Can't what? Write it down like this?

Struct[(int)0]

Yes, you cannot write it like that. All the more so - Struct[(MqlTick)0]


Forum on trading, automated trading systems and strategy tester

New version of MetaTrader 5 build 1570: Improvement of the Market Watch and Extension of Template Functions in MQL5

MetaQuotes Software Corp., 2017.03.22 16:31

  1. MQL5: The possibility of explicit specialisation of template functions has been added. For this purpose, typing parameters must be specified before the list of call parameters:
    template<typename T>
    T Func() { return (T)0; }
      
      
    void OnInit()
      {
       Func<double>();   // явная специализация шаблонной функции
      }
    Thus, specialisation is not through call parameters, but by explicitly specifying types.
 
C is a cool programming language. But, a lot of people program with their eyes squeezed shut(:
 

Thus, specialisation is not through calling parameters, but through direct indication of types.

Types of what, sir? What is the type of the structure you are raping?

 
Алексей Тарабанов:

What type of structure do you rape?

struct STRUCT
{
  template <typename T>
  void operator []( int )
  {
    Print(__FUNCSIG__);
  }
};

void OnStart()
{
  STRUCT Struct;
  
  Struct.operator[]<int>(0);
  Struct.operator[]<MqlTick>(0);
}

Result
void STRUCT::operator[]<int>(int)
void STRUCT::operator[]<MqlTick>(int)
 
fxsaber:

Result

Simply study the data types.
 
Алексей Тарабанов:
Just study the types of data.
Having a sense of humour - ticked the box.
 
fxsaber:
Having a sense of humour - ticked the box.

Thank you
 
Renat Fatkhullin:

The task has already been set to change this strategy and bring up data no deeper than 500 bars from the furthest date of the request. This will allow for painless writing of market screeners.

1. will it be possible to change this depth?

2. where in MT5 are the limits of loaded history regulated?

 
I have read the Tutorial for Dummies. I have an algorithm, but I can not properly prescribe it.
So the idea is that I access the data set of the last 86 candles, except 0. Each white candle is 1, each black candle is 0. If the closing price of 1 candle is equal tothe opening price of 1 candle, then look at the closing price of 2 candles and if it is higher than the opening price of 1 candle, then put 0. If the closing price of 2 candles is equal to the opening price of 1 candle, then by the same principle, compare the opening price of 2 candles with the closing price of 2 candles.
The cycle runs every 15 min or 60
 
Is this a bug in the language or an undocumented feature?
struct STRUCT
{
  void operator =( STRUCT& ) { Print(__FUNCSIG__); }
};

void OnStart()
{
  STRUCT Struct = {0};
  
  Struct = (STRUCT)Struct; // Пусто
  Struct = Struct;         // void STRUCT::operator=(STRUCT&)
}

The operator is not called, even if you make it a template operator!

Reason: