Hi all!
I'm coding an expert using CAppDialog where I'm displaying some information for the user.
It's working well but I noticed that when I change a variable in the configuration for the timeframe for candle period in the chart, the expert is suddenly exiting. This happens only for this parameter, nothing weird happens when I change any other parameter. It works well even if I change the tradesymbol.
If I set the variable to use the default timeframe = PERIOD_CURRENT and change the timeframe using the MT5 toolbar, it also works well.
I also removed all references for the panel (CAppDialog) and I run the same tests. Everything worked fine.
From my description it looks like it might be something related to the call for ChartSetSymbolPeriod(). Am I using it incorrectly? Is something I need to take tare when using it with CAppDialog?
The issue is not with changing the timeframe, the issue is that doing so will cause OnDeinit() to be called. So depending how you have coded to survive a restart various problems will occur especially with CAppDialog objects.
You need to code to ensure that settings are preserved and reinstated during changes and restarts, that may mean destroying the panel and recreating it.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi all!
I'm coding an expert using CAppDialog where I'm displaying some information for the user.
It's working well but I noticed that when I change a variable in the configuration for the timeframe for candle period in the chart, the expert is suddenly exiting. This happens only for this parameter, nothing weird happens when I change any other parameter. It works well even if I change the tradesymbol.
If I set the variable to use the default timeframe = PERIOD_CURRENT and change the timeframe using the MT5 toolbar, it also works well.
I also removed all references for the panel (CAppDialog) and I run the same tests. Everything worked fine.
From my description it looks like it might be something related to the call for ChartSetSymbolPeriod(). Am I using it incorrectly? Is something I need to take tare when using it with CAppDialog?
Any help is really appreciated...
Thanks!
>> This is the code snippet where this configuration is applied.
------------
------------ This is the output from the expert log
>> Expert log output
<< Changing period for a moving average... >> -- OK
2024.08.02 00:16:29.972 ALT_TestCode (WINQ24,M5) Entering OnDeinit() with reason: 5
2024.08.02 00:16:29.972 ALT_TestCode (WINQ24,M5) Releasing hndlMA1
2024.08.02 00:16:29.972 ALT_TestCode (WINQ24,M5) Releasing hndlMA2
2024.08.02 00:16:29.972 ALT_TestCode (WINQ24,M5) Releasing hndlMaFilter
2024.08.02 00:16:29.972 ALT_TestCode (WINQ24,M5) Releasing hndlBBFilter
2024.08.02 00:16:29.978 ALT_TestCode (WINQ24,M5) Exiting OnDeinit()
2024.08.02 00:16:29.979 ALT_TestCode (WINQ24,M5) Entered OnInit()
2024.08.02 00:16:29.979 ALT_TestCode (WINQ24,M5) ALT_TestCode> Ref candle != current candle. Analyzing @ opening of ref candle
2024.08.02 00:16:29.987 ALT_TestCode (WINQ24,M5) ALT_TestCode> EMA Fast :: Applying WINQ24 timeframe: PERIOD_CURRENT and period: 9
2024.08.02 00:16:29.987 ALT_TestCode (WINQ24,M5) ALT_TestCode> EMA MEdium :: Applying WINQ24 timeframe: PERIOD_CURRENT and period: 20
2024.08.02 00:16:30.203 ALT_TestCode (WINQ24,M5) Exiting OnInit() with INIT_SUCCEEDED
<< Changing chart timeframe... >> -- Exiting expert
2024.08.02 00:16:51.657 ALT_TestCode (WINQ24,M5) Entering OnDeinit() with reason: 5
2024.08.02 00:16:51.657 ALT_TestCode (WINQ24,M5) Releasing hndlMA1
2024.08.02 00:16:51.657 ALT_TestCode (WINQ24,M5) Releasing hndlMA2
2024.08.02 00:16:51.657 ALT_TestCode (WINQ24,M5) Releasing hndlMaFilter
2024.08.02 00:16:51.657 ALT_TestCode (WINQ24,M5) Releasing hndlBBFilter
2024.08.02 00:16:51.661 ALT_TestCode (WINQ24,M5) Exiting OnDeinit()
2024.08.02 00:16:51.662 ALT_TestCode (WINQ24,M5) Entered OnInit()
2024.08.02 00:16:51.662 ALT_TestCode (WINQ24,M5) ALT_TestCode> Ref candle != current candle. Analyzing @ opening of ref candle
2024.08.02 00:16:51.947 ALT_TestCode (WINQ24,M5) ALT_TestCode> EMA Fast :: Applying WINQ24 timeframe: PERIOD_M15 and period: 9
2024.08.02 00:16:51.963 ALT_TestCode (WINQ24,M5) ALT_TestCode> EMA MEdium :: Applying WINQ24 timeframe: PERIOD_M15 and period: 20
2024.08.02 00:16:51.982 ALT_TestCode (WINQ24,M5) Exiting OnInit() with INIT_SUCCEEDED
... It was OK untill here. I have no idea why it is entering OnDeinit() again...
2024.08.02 00:16:51.982 ALT_TestCode (WINQ24,M5) Entering OnDeinit() with reason: 3
2024.08.02 00:16:51.982 ALT_TestCode (WINQ24,M5) Releasing hndlMA1
2024.08.02 00:16:51.982 ALT_TestCode (WINQ24,M5) Releasing hndlMA2
2024.08.02 00:16:51.982 ALT_TestCode (WINQ24,M5) Releasing hndlMaFilter
2024.08.02 00:16:51.982 ALT_TestCode (WINQ24,M5) Releasing hndlBBFilter
2024.08.02 00:16:52.131 ALT_TestCode (WINQ24,M5) Exiting OnDeinit()