Errors, bugs, questions - page 1783
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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
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.
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
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.
Can you clarify which threads we are talking about? Don't all indicators of the same symbol work in the same thread?
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
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.
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?
Execution error
Access violation at 0x030A00AD read to 0x00000005 in 'Test_s.ex5'
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" ); }
#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
Put it in Help, please.
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
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.