Errors, bugs, questions - page 2345

 
Aleksey Vyazmikin:

How do I understand this - I am testing with OHLC on M1 and at closing on SL I get a sensible profit/loss (33606-33608=-2), but when I close on take profit - nonsense (33591-33506=29), yes, I see that the price is "33562" but where did that price come from? The minute bar is less!

If anyone knows the reason, and this is not a bug, I beg you to tell!

Testing on real ticks does not change the picture.

Please, give a log of the moment of closing and real ticks (CTRL+U) around this event.

 
Error during compilation
class A {
    static int i;
} a; //Error: unresolved static variable 'A::i'
int A::i;
Otherwise:
class A {
    static A i;
} a;
A A::i;
It's fine. What difference does it make?
 

I searched the whole forum, I couldn't find it (((.

Here's my class:

class Myclass
  {
public:
                     Myclass();
                    ~Myclass();
   void              OnInit();
   void              OnDeinit();
   void              OnTick();
   void              OnTester();
   void              OnTimer();
  };

I want to call event handlers in the class in standard event handling functions

How do I make a macro substitution? (or a function template... that will automatically set event handlers for class instances)

 
Igor Makanu:

I searched the whole forum, I couldn't find it (((.

Here's my class:

I want to call event handlers in the class in standard event handling functions

How do I make a macro substitution? (or a function template..., something that will automatically assign handlers to class instances)

You can see an example here.

Init_Sync
Init_Sync
  • www.mql5.com
Если в MT изменить таймфрейм или имя символа чарта, то все индикаторы на чарте выгрузятся с чарта и загрузятся на него снова. При этом, в отличие от MT4, в MT5 последовательность выгрузиться/загрузиться не определена из-за особенности внутренней архитектуры. Данное обстоятельство иногда вызывает не сразу очевидные проблемы, связанные с тем, что...
 
fxsaber:

You can see an example here.

alas, i have studied all your examples for the last hour, i can't be a master of defines)))

here's your response, i made myself by analogy, it compiles, everything works, but i can "wrap" one instance of the class in macro substitution

class Myclass
  {
public:
                     Myclass(){};
                    ~Myclass(){};
   void              OnInit(){Print(__FUNCSIG__," выполнен");};
   void              OnDeinit();
   void              OnTick();
   void              OnTester();
   void              OnTimer(){Print(__FUNCSIG__," выполнен");};
  } m_class;
//+------------------------------------------------------------------+
#define  CHECK_INIT_TIMER m_class.OnTimer();
void OnTimer( void )
{
  CHECK_INIT_TIMER;
  ::OldOnTimer();
}
#define OnTimer OldOnTimer
//+------------------------------------------------------------------+

#define  CHECK_INIT_INIT m_class.OnInit();
void OnInit( void )
{
  CHECK_INIT_INIT;
  ::OldOnInit();
}
#define OnInit OldOnInit

but if i have 3-5 instances of a class, how can i wrap it in macro substitutions?

 
fxsaber:

Bring log of closing time and actual ticks (CTRL+U) around this event.

Looked - no ticks, two terminals hung up when trying to request - requested for just one day... but by traffic it looks like it's been downloaded for the whole time (I download the futures, not the glue).

So, let there be no ticks conditionally, then what?

 
Aleksey Vyazmikin:

So, let there be no ticks conventionally, then what?

Anything. On fins or asc could have closed. Spread on the bar could be anything, etc. It's a guessing game, really.

 
Igor Makanu:

and if I have 3-5 instances of the class, how do I wrap this in macro substitutions?

I don't understand the task yet.

 
fxsaber:

I don't understand the task yet.

I want to write only #include <fileclass.mqh> in expert code

and then declare 3 instances of the class in the code of the Expert Advisor: Myclass m_class1, m_class2, m_class3

and want to get macro substitutions in standard event handling functions

SZY: for one instance of the class, you have helped, advised where to look - everything works, but for 3 instances of how to do I do not understand (((

 
fxsaber:

Anything. On flippers or asc could have closed. Spread on the bar could have been anything, etc. A guessing game, in short.

From the documentation.

The difference between the Bid and Ask prices is called the spread. During testing, the spread is not modelled, but taken from the historical data. If the spread is less or equal to zero in the historical data, the last known spread at the time of generation is used.

Since there are no ticks, the spread is the same throughout the testing interval, and it is small.
Reason: