Errors, bugs, questions - page 1783

 
A100:

Question: When will OnDeinit->M5 be called ?

My answer: Never!

Your answer above: asynchronously and with a delay

More than 30 minutes have passed and OnDeinit->M5 is still not called

And now let's change the Expert Advisor's code (change the order slightly) ...

Result:

2017.02.06 01:31:45.002 OnInit->M5
2017.02.06 01:31:48.340 OnDeinit->M5:1 Called immediately and without delay!
2017.02.06 01:31:48.409 OnInit->M15

Files:
Test.mq5  2 kb
 
A100:

More than 30 minutes have passed, and there is still no OnDeinit->M5 call

And now let's change the Expert code (change the order slightly) ...

Attach the code, please.
 
Renat Fatkhullin:
Attach the code, please.
Attached to the last post with the same name. Actually a static call has been replaced by a dynamic one and the result is fundamentally different
 
A100:
Attached to the last post with the same name. Actually a static call has been replaced by a dynamic one and the result is fundamentally different
Thank you, let's look into it.

It seems that in the first case the absence of OnDeinit and the static variable, which we forgot to call the destructor in the result, played a bad trick on optimization.
 
Alexey Kozitsyn:
Can you clarify which threads we are talking about? Don't all indicators of the same symbol work in the same thread?
Yes. The different threads will be if the chart changes the symbol, not the timeframe.

If we change only the timeframe, the new copy of the indicator will be calculated in the same thread as the old one.

But also we cannot rely on the fact that the Deinit command on M5 will be processed earlier than the Init command on M15
 
Slawa:
If we change only the timeframe, the new copy of the indicator will be calculated in the same thread as the old one.

But here we cannot rely on the fact that the Deinit command on M5 will be processed earlier than the Init command on M15.
Please add it to the Help, please.
 
Slawa:

Hello,

please pay very close attention to the message https://www.mql5.com/ru/forum/166358/page4#comment_4064293

This is very important,

there is a new error 1158, is it not in the help?

cannot set millisecond timer (500)
cannot set millisecond timer (500)
  • www.mql5.com
Здравствуйте, клиент прислал лог файл, в котором я увидел такую запись cannot set millisecond timer (500) что она значит? и почему...
 

Execution error

Access violation at 0x030A00AD read to 0x00000005 in 'Test_s.ex5'

//Test_s.mq5 //Скрипт
class A {};
#import "TestA.ex5"
        A *error();
#import
class B { protected:
    B( const string& name ) : name( name ) {}
    virtual int g( const MqlParam& param[] ) const { return ::IndicatorCreate( NULL, PERIOD_CURRENT, IND_CUSTOM, ::ArraySize( param ), param ); }
        const string name;
bool f( int h ) const
{
        if ( ::ChartIndicatorAdd( 0, 0, h ) )
                return true;
        error();
        return false;
}
};
class C : protected B { protected:
    C( int h, string name ) : B( name ), h( h ) { f( this.h ); }
        const int h;
};
class D : C { public:
    D( string path ) : C( g( path ), path ) {}
int g( const string& path )
{
        MqlParam param[ 1 ];
        param[ 0 ].type         = TYPE_STRING;
        param[ 0 ].string_value = path;
        return g( param );
}
};
void OnStart() { D d( "Test_i" ); }
//TestA.mq5
#property library
class A {};
A * error() export { return NULL; }

All files (except the Indicator) are located in the MQL5 folder\Scripts\.

The Indicator itself is not required, but it can be downloaded, e.g., fromhttps://www.mql5.com/ru/forum/1111/page1803#comment_4063671

Ошибки, баги, вопросы
Ошибки, баги, вопросы
  • www.mql5.com
Форум алго-трейдеров MQL5
 
fxsaber:
Put it in Help, please.
Look here - Running programs

For a summary of the programmes in MQL5, see the table below:

Program

Execution

Note

Script

In its own thread, as many scripts as there are execution threads for them

A looped script cannot interrupt the work of other programs

Expert

In its own thread, as many experts - as many execution threads for them

A looped expert cannot disrupt work of other programs

Indicator

One execution thread for all indicators on one symbol. As many symbols with indicators - as many execution threads for them

Endless loop in one indicator will stop all other indicators on this symbol

 
A100:

They are written in the form B'111111111111111111111111111111'.

Alas, I am not familiar with this format.

The experiment showed that the number in the graphical buffer is represented by the same rules as double - i.e. it is not possible to pass such a long number through the graphical buffer - frustrating.