I have a problem with my EA in the latest build - 1045. When switching TFs or Symbols EA is not initialized.
I am only personally seeing a problem under the following circumstances:
An EA does ChartSetSymbolPeriod() on its own chart
There is other code, after ChartSetSymbolPeriod(), before the EA exits from OnTimer()/OnTick()
I appear to be able to fix this for my own code by making sure that ChartSetSymbolPeriod() is the last thing which the EA does before returning from OnTimer()/OnTick()
However, I'm very suspicious that there is some sort of race condition in the new build of MT4. It looks very plausible that there is a problem which, for me, only manifests itself in an EA changing its own symbol/timeframe, but on other computers is capable of applying to things like the manual changing of symbol/tf which you describe.
In short: I can definitely confirm some kind of bug, which goes away if I downgrade to v1031.
In short: I can definitely confirm some kind of bug, which goes away if I downgrade to v1031.
... Now that I go back and check, the problem also applies to the interim testing builds 1032 and 1033. The last unaffected, bug-free build is the release v1031.
I am only personally seeing a problem under the following circumstances:
An EA does ChartSetSymbolPeriod() on its own chart
There is other code, after ChartSetSymbolPeriod(), before the EA exits from OnTimer()/OnTick()
I appear to be able to fix this for my own code by making sure that ChartSetSymbolPeriod() is the last thing which the EA does before returning from OnTimer()/OnTick()
However, I'm very suspicious that there is some sort of race condition in the new build of MT4. It looks very plausible that there is a problem which, for me, only manifests itself in an EA changing its own symbol/timeframe, but on other computers is capable of applying to things like the manual changing of symbol/tf which you describe.
In short: I can definitely confirm some kind of bug, which goes away if I downgrade to v1031.
If you mean it, then this bug with ChartSetSymbolPeriod was there some time ago. The worst thing was, that after init/deinit the script continued with the command immediately following the ChartSetSymbolPeriod (which usually ended in crash).
If you mean it, then this bug with ChartSetSymbolPeriod was there some time ago. The worst thing was, that after init/deinit the script continued with the command immediately following the ChartSetSymbolPeriod (which usually ended in crash).
Never previously had a problem with ChartSetSymbolPeriod(). I only see a problem in builds 1032 onwards, not in the last release v1031.
I deleted this part of code from my Trade Panel EA. [...]
(I don't want to sound like a broken record, but I'd currently place a small bet that the issue is not specifically to do with chart objects, but is instead that the time spent cleaning up the chart objects creates a timing issue vs other actions to do with reloading the EA.)
JC: (I don't want to sound like a broken record, but I'd currently place a small bet that the issue is not specifically to do with chart objects, but is instead that the time spent cleaning up the chart objects creates a timing issue vs other actions to do with reloading the EA.)
I now have a pretty minimal test case.
If I load the following EA onto a chart...
#property strict
voidOnTick() {}
voidOnDeinit(constint reason) { Sleep(1); }
... then, when I manually change the timeframe or symbol of the chart, the EA is unloaded but not reloaded.
... then, when I manually change the timeframe or symbol of the chart, the EA is unloaded but not reloaded.
Works fine in build 1031.
I do not use Sleep(), but I use EventSetTimer(), EventKillTimer(), so I removed them ( for just test ) but EA still does not reloaded when I try to change timeframes.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
I think thread name is enough.
MetaTrader 4 Terminal, Build 1045
The Code:
int OnInit() {
Print("start");
return(INIT_SUCCEEDED);
}
void OnDeinit(const int reason) {
Print("end"); // Does not print "end" to the log when closing the chart window
}
The Log:
2017.02.05 17:18:14.231 Expert test EURUSD+,H1: removed
2017.02.05 17:18:14.215 test EURUSD+,H1: uninit reason 4
2017.02.05 17:18:12.287 test EURUSD+,H1: initialized
2017.02.05 17:18:12.287 test EURUSD+,H1: start
2017.02.05 17:18:11.006 Expert G1\test EURUSD+,H1: loaded successfully
QUESTION
Where is my "end"?
Instruction:
1. Run the expert.
2. Close the chart window with the expert (do not remove the expert from the chart because in this case "end" is printed - at least sometimes).
Tip
Destructors for automatic objects are not called as well.
I have a problem with my EA in the latest build - 1045. When switching TFs or Symbols EA is not initialized.
I am only personally seeing a problem under the following circumstances:
I appear to be able to fix this for my own code by making sure that ChartSetSymbolPeriod() is the last thing which the EA does before returning from OnTimer()/OnTick()
However, I'm very suspicious that there is some sort of race condition in the new build of MT4. It looks very plausible that there is a problem which, for me, only manifests itself in an EA changing its own symbol/timeframe, but on other computers is capable of applying to things like the manual changing of symbol/tf which you describe.
In short: I can definitely confirm some kind of bug, which goes away if I downgrade to v1031.
In short: I can definitely confirm some kind of bug, which goes away if I downgrade to v1031.
I am only personally seeing a problem under the following circumstances:
I appear to be able to fix this for my own code by making sure that ChartSetSymbolPeriod() is the last thing which the EA does before returning from OnTimer()/OnTick()
However, I'm very suspicious that there is some sort of race condition in the new build of MT4. It looks very plausible that there is a problem which, for me, only manifests itself in an EA changing its own symbol/timeframe, but on other computers is capable of applying to things like the manual changing of symbol/tf which you describe.
In short: I can definitely confirm some kind of bug, which goes away if I downgrade to v1031.
If you mean it, then this bug with ChartSetSymbolPeriod was there some time ago. The worst thing was, that after init/deinit the script continued with the command immediately following the ChartSetSymbolPeriod (which usually ended in crash).
If you mean it, then this bug with ChartSetSymbolPeriod was there some time ago. The worst thing was, that after init/deinit the script continued with the command immediately following the ChartSetSymbolPeriod (which usually ended in crash).
Never previously had a problem with ChartSetSymbolPeriod(). I only see a problem in builds 1032 onwards, not in the last release v1031.
The behaviour I am seeing is as follows:
This seems related to the other reports regarding manual changes of tf/symbol, and screams "race condition" at me.
I deleted this part of code from my Trade Panel EA. It works perfect.
But I need to use it.
{
bool order_selected=OrderSelect(i,SELECT_BY_POS,MODE_HISTORY);
if(order_selected==1)
{
ObjectsDeleteAll(0,"#"+IntegerToString(OrderTicket()));
ObjectsDeleteAll(0,prefix+" #"+IntegerToString(OrderTicket()));
}
}
Any help, would be better.
Thanks.
I deleted this part of code from my Trade Panel EA. [...]
(I don't want to sound like a broken record, but I'd currently place a small bet that the issue is not specifically to do with chart objects, but is instead that the time spent cleaning up the chart objects creates a timing issue vs other actions to do with reloading the EA.)
I now have a pretty minimal test case.
If I load the following EA onto a chart...
void OnTick() {}
void OnDeinit(const int reason)
{
Sleep(1);
}
... then, when I manually change the timeframe or symbol of the chart, the EA is unloaded but not reloaded.
Works fine in build 1031.
I now have a pretty minimal test case.
If I load the following EA onto a chart...
void OnTick() {}
void OnDeinit(const int reason)
{
Sleep(1);
}
... then, when I manually change the timeframe or symbol of the chart, the EA is unloaded but not reloaded.
Works fine in build 1031.