Do these charts need a recalculation when values change ?
If not , you can have a trigger file with timestamp in it , and read it from the "following" ea's at time intervals .
When the timestamp is different than the previous one , you pull the file contents (that the master ea populates) from the other eas.
If not , you can have a trigger file with timestamp in it , and read it from the "following" ea's at time intervals .
When the timestamp is different than the previous one , you pull the file contents (that the master ea populates) from the other eas.
Lorentzos Roussos:
Do these charts need a recalculation when values change ?
If not , you can have a trigger file with timestamp in it , and read it from the "following" ea's at time intervals .
When the timestamp is different than the previous one , you pull the file contents (that the master ea populates) from the other eas.
Thank you Lorentzo. Do these charts need a recalculation when values change ?
If not , you can have a trigger file with timestamp in it , and read it from the "following" ea's at time intervals .
When the timestamp is different than the previous one , you pull the file contents (that the master ea populates) from the other eas.
Yes they do.
I will keep in mind this solution also.
Don't actually use OnInit for those purposes. Instead make your own reinit function and invoke it by sending a custom chart event to the worker EAs from the master... something like this.
#define EVENT_SEND_REINIT 900 input bool inp_is_master = false; //+------------------------------------------------------------------+ int OnInit() { if(inp_is_master){ Alert("Master is here, telling everyone to reinitialize!"); for(long ch=ChartFirst(); ch >=0; ch=ChartNext(ch)){ EventChartCustom(ch, EVENT_SEND_REINIT, 0, 0.0, NULL); } } return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ void OnTick(){} //+------------------------------------------------------------------+ void OnChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam) { if(id == CHARTEVENT_CUSTOM+EVENT_SEND_REINIT && !inp_is_master) reinit(); } //+------------------------------------------------------------------+ void reinit() { //do file stuff, etc. Alert(StringFormat("%lld reinitializing.", ChartID())); }
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
Hi guys
I am trying to find a way to programmatically re-initialise all of the active charts.
What I tried is to write a loop that goes through all the active charts and change the TF to M1 and back to its previous TF.
The problem with the above function is that the "period" that was meant to save the initial TimeFrame of the chart gets lost and does not proceed.
Also changing the TF could disturb the smooth operation of the EA.
Does anyone have any suggestion of how to achieve that?
The reason is the following.
I have several charts running the same EA with a function in the init() part that reads a file.
I only need to read the file on the initialization.
The file gets populated based on another EA (Master EA) that runs on another chart. Whenever this master EA gets initialized the file gets updated
and therefore I need the other charts to re-initialize so they can read the new values.