Is there any way to avoid it?
Thnaks in advance,
Juan
when you change timeframe your indicator/ea is restarted so you need to anticipate this and save any variables that you want to keep first and reset them when it restarts.
you can use terminal global variables or write data to a file to achieve this
Is there any way to avoid it?
Thnaks in advance,
Juan
Here is the modification of the panel. What has been done: the 'edit_value' variable is declared in the EA (NOT IN THE PANEL!!!).
//+------------------------------------------------------------------+ //| Global Variables | //+------------------------------------------------------------------+ CControlsDialog ExtDialog; string edit_value="-1"; // '-1' -> start value //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit()
When deinitializing to this rename, we save the value from the CEdit element. Two methods have been added to the panel:
//--- create virtual bool Create(const long chart,const string name,const int subwin,const int x1,const int y1,const int x2,const int y2); //--- chart event handler virtual string GetValue(void) const { return(m_edit.Text()); } //--- chart event handler virtual void SetValue(const string value) { m_edit.Text(value); } protected: //--- create dependent controls bool CreateEdit(void);
Added print statements to OnInit and OnDeinit so you can control the 'edit_value' variable
Very thankful. It works perfectly.
Best regards,
Juan

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Is there any way to avoid it?
Thnaks in advance,
Juan