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
Not sure (I never tried) if the static int i=0; keeps its value after the reinit. Can you confirm?
Yes it does - so the EventSetTimer works like a continuous loop with 3 second (as above) delay.
And what is your expectation (how it should behave)? I cannot see you killed or rescheduled the timer elsewhere except the init and deinit.
Yes as that is what is recommended in the documentation. So descriptively I want it to change charts every 3 seconds (say) for a specified number of charts i.e from 5M to H4 (5 charts) - at each change I have other code to calculate stuff and print results/parameters.
After it has finished scrolling through all charts I want it to stop until another specified time - let's say 5 minutes later. So 5 minutes later it will perform the same tasks.
At the moment the way the code is written it continuously scrolls through charts every 3 seconds.
Yes as that is what is recommended in the documentation. So descriptively I want it to change charts every 3 seconds (say) for a specified number of charts i.e from 5M to H4 (5 charts) - at each change I have other code to calculate stuff and print results/parameters.
After it has finished scrolling through all charts I want it to stop until another specified time - let's say 5 minutes later. So 5 minutes later it will perform the same tasks.
At the moment the way the code is written it continuously scrolls through charts every 3 seconds.
OK, it is clear now. You may change the timer period any time. In this case right after the timeframe change, something like:
In case you expect the 3-second interval to be reached likely during init (all indicators on the chart would init), use rather a static variable in init() for the new schedule decision.
OK, it is clear now. You may change the timer period any time. In this case right after the timeframe change, something like:
In case you expect the 3-second interval to be reached likely during init (all indicators on the chart would init), use rather a static variable in init() for the new schedule decision.
It seems the program ignores the second EventSetTimer() command. The chart change is still 3 seconds from the original in the init() function.
This is what should happen:
change to M1 chart: do calcs.....after 3 seconds
change to M15 chart: do calcs...after 3seconds
change to H4 chart: do calcs......stop chart change process for 5 minutes
resume the 3 second chart change process...then stop again for 5 minutes etc;
It seems the program ignores the second EventSetTimer() command. The chart change is still 3 seconds from the original in the init() function.
This is what should happen:
change to M1 chart: do calcs.....after 3 seconds
change to M15 chart: do calcs...after 3seconds
change to H4 chart: do calcs......stop chart change process for 5 minutes
resume the 3 second chart change process...then stop again for 5 minutes etc;
So turn it off, then set it. If it works, tell the service desk.
Couldn't get the Timer() to work.
This did though.
Couldn't get the Timer() to work.
This did though.
I tested your code, and I realized they changed (or fixed) behaviour of the ChartSetSymbolPeriod(0,NULL,...).
Last time I checked it interrupted current method to initialize the entire chart, and now it seems to finish the OnTimer() first before it runs OnDeinit & OnInit() couple. In that case, setting the long timer delay was overwritten back in the OnInit() rather than the other way round.I tested your code, and I realized they changed (or fixed) behaviour of the ChartSetSymbolPeriod(0,NULL,...).
Last time I checked it interrupted current method to initialize the entire chart, and now it seems to finish the OnTimer() first before it runs OnDeinit & OnInit() couple. In that case, setting the long timer delay was overwritten back in the OnInit() rather than the other way round.If I run the code below it shows that the ChartSetSymbolPeriod() function is out of sync with the displayed chart Period().
If I change the chart symbol I would have expected it to show under Period()!!
Am I doing something wrong here?