1. Why is it necessary for an EA to deinitialize and reinitialize if I change the timescale of a chart? I see no reason for this, and it doesn't help me.
2. If it is necessary, can I supress the messages that are shown in the Experts tab regarding initialization and deinitialization? They make it harder to find the messages that my EA sends there. The RSI indicator sends messages out as well and I would rather it didn't too.
1. If you see no reason for it, then I suggest you read more about how MT4 works. Not everything is easily calculated on demand as a tick comes in. If nothing else, can you not see that changing the TF invalidates just about everything that your EA has in its memory? Things like 'last tick time' or 'value of last 3 fractal peaks' or 'how many bars since last week end'? I use init() to reset global variables & initialise arrays. Also, as I am limited to just 8 Index Buffers, I reset various indicator values that I recalc from scratch for when I change a TF or Symbol, and call start() for the first time following that.
2.a You are obviously someone who believes that ignorance is bliss, and that nothing can go wrong. When EAs go BAD, you'll find a wealth of information in there. 2.b Prefix your message with !!@@##$$%% or some such instantly recognisable string.
I wouldn't be surprised if you wonder why your car has a seat belt, because you've never needed it before.
I don't mean to sound harsh, but I've encountered many systems in the past decades that are a real pain in the a** to debug because they hide information from you or else insist that you do things only in the limited way that the originator thought was the right way to do it.
1. It is not necessary for you to change it - you can run EA on one chart (minimized most of time) and satisfy your curiosity on another chart of the same symbol.
2. You can't. (1.) will relieve you of init/deinit events of EAs, but any custom indicators will keep spamming. If you are coding EAs yourself, you can write events you really don't want to miss to a txt file.
I have an EA that monitors several time frames for patterns that I trade off. If it finds an appropriate pattern then I want it to show me the chart on that timeframe. It then prompts me whether I want to take the trade. It's a pain that the EA deinitialises after changing the timeframe because it means I have to store all my data to a file and then recover this in the init() sub.
Drave I already run the EA on about ten different markets. I need the EA on a chart for each symbol so that I catch all the ticks. I don't want to have two charts for each symbol, it will be too cumbersome.
brewmanz I find your tone unnecessarily rude. In any case I don't see why changing the timeframe invalidates everything my EA has in memory. The last tick time is the same whatever the timeframe, I don't know or care what fractal peaks are, and the number of bars since last weekend will change, but so what, I'm looking over a range of timeframes all the time in any case.
It's a pain that the EA deinitialises after changing the timeframe because it means I have to store all my data to a file and then recover this in the init() sub.
1. Any reasonable EA should be able to recover from unloading, power outage, crash, etc. anyways, so there is no way around properly persisting the state.
2. A time frame change does not clear your global variables, you can simply ignore this event if you don't need it.
1. Yes, but I'm only talking about persisting the data between the system identifying a trade and prompting me to take it. Data relating to existing trades needs persisting but that's a different matter.
2. You're right. I had assumed this wouldn't be the case. That does make things easier.
WHRoeder, not sure that I fancy that. It will be too much of a visual distraction all those timeframe changes.
You get a visual distraction every time you change timeframe. The only difference is clicking on the window drop down box and chosing the chart you want to look at. Not a great deal of difference in the process.
The first changing time frame is slow the second is quicker as it is already created.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.