Hi, if you change a setting only this EA get's restarted. if you have coded it properly it should not be a problem or affect other EA's.
//z
sebastianhh:
[...] During live testing (real money, real time) I would like to change some setting in the EA that are adjustable during launch (extern int EMAperiod=21;) . Can I do that while it is working. [...]
No problem, as long as your EA is designed to go through a deinit() -> init() -> start() cycle and continue working...
[...] During live testing (real money, real time) I would like to change some setting in the EA that are adjustable during launch (extern int EMAperiod=21;) . Can I do that while it is working. [...]
gordon:
No problem, as long as your EA is designed to go through a deinit() -> init() -> start() cycle and continue working...
I want to my MA indicator to change its period automatically as per some conditions, it it possible?
No problem, as long as your EA is designed to go through a deinit() -> init() -> start() cycle and continue working...
Jup,
now I got it. It works perfectly fine.
But what happens when I change the Timeframe. e.g. I have the EA running and it is suppose to do some action with the EMA70. Now I change the timeframe from M15 to M30. Does the EA calculates a new EMA70, now based on the new M30 timeframe or does it do the same action as it was launched in the M15 setting?
Thanks.
That depents if you call your indicator with Period() or PERIOD_M15
//z
It is Period(). So it always uses the timeframe of the current chart?
sebastianhh:
It is Period(). So it always uses the timeframe of the current chart?
Correct
It is Period(). So it always uses the timeframe of the current chart?
gordon:
No problem, as long as your EA is designed to go through a deinit() -> init() -> start() cycle and continue working...
Remember, that cycle does not modify or reset global/static variables. If you have code likeNo problem, as long as your EA is designed to go through a deinit() -> init() -> start() cycle and continue working...
init(){ if (Digits == 5) TP*=10;then TP becomes 10x, 100x, ...
I think it is fine like that.
extern int MagicNumber=123456; extern double Lots=1; extern int Timeframe=0; extern int EMA_PeriodSlow=100; extern double SL_EMA_Buyfactor=0; extern double TP_EMA_Buyfactor=0; extern double SL_EMA_Sellfactor=0; extern double TP_EMA_Sellfactor=0; extern string TradeStartTime ="00:00"; extern string TradeStopTime = "23:59"; string MagicNum; bool Trading_on_off = true; double places; bool Close_at_EMA_break=true; //********************************************************************* int init(){ if (Digits==3 || Digits==5) places=10.0; else places=1.0; return(0); return(0); } //********************************************************************* int start(){ if(TimeCurrent()>StrToTime(TradeStartTime) && TimeCurrent()<StrToTime(TradeStopTime)) Trading_on_off = true;
Hi,
To control EA on the fly may be used "Global Variables" window.
See, for example:
Regards,
Airat
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
I have programed my EA and now I am optimising the settings. During live testing (real money, real time) I would like to change some setting in the EA that are adjustable during launch (extern int EMAperiod=21;) . Can I do that while it is working. e.g. I would like to change the EMA Period, TradeStopTime because the market has changed and an other settings are better. But I do not want to restart the MT4 or EA because it is working on other Instruments at the same time.
Best, Sebastian