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
Yes, regardless of ChartSetSymbolPeriod() being called from OnTick() or from OnTimer(), the symbol/TF changes correctly, the EA de-initializes, but doesn't restart - in other words, the EA dettaches from the chart.
So the function ChartSetSymbolPeriod() is apparently working, but whatever it is that should trigger the EA to restart isn't - and that's what is puzzling. I can't use the function as it is removing the EA without starting again.
At my own risk of being Captain Obvious, do you have this Option checked?
At my own risk of being Captain Obvious, do you have this Option checked?
Yes. And no worries about being Captain Obvious, sometimes it is needed.
if it gives you any comfort I had the same issue last night in one of my terminals but it worked two nights ago in other two terminals. To be fair, when it worked two nights ago, the terminals were running version 5 build 5120 and with the one that DID NOT work last night it was running the latest build 5200(in case any the versions matter)
As you mentioned deInit() was called correctly, you can see the last of the notification in the logs below showing it was unloaded from the chart. and there is just silence after that. no failure of any kind. it's like it didn't even try to reload the EA onto the new chart.
this is the code I'm running to make the switch:
I call the code above when all positions have been closed(were greater than zero and recently switched to zero open positions) and some other conditions are true.
things I observed after the incident:
my only guess is something like an internal timeout. Something like it must complete the chart reload and load the EA in this amount of time otherwise it gives up. just to give you context, my terminal was probably busy at that time. in a fraction of a second it was processing and CTrade was logging 400+ positions being closed, it sent out a few push notifications, reloaded the chart in a new symbol, unloaded the current EA. My VM isn't a beefy machine and has two other terminals running that were likely idle, but still consuming memory from the machine. I was also reloading the chart in M1 and it was a newly released symbol by the broker, maybe pulling all the tick info just took a while and caused it to time out silently? I don't know, just speculating here.
by the way, you know that you must have the symbol in the market watch window otherwise ChartSetSymbolPeriod() fails, right?