Please help. I want set period parameters of custom-indicators "on the fly", but not work, why?
ENUM_TIMEFRAMES tf0,tf,tf1; void OnInit() { ................. tf0 = PERIOD_CURRENT; switch (PERIOD_CURRENT) { case PERIOD_M1: tf =PERIOD_M5;tf1 =PERIOD_M15; break; case PERIOD_M5: tf =PERIOD_M15; tf1 =PERIOD_H1;break; case PERIOD_M15: tf =PERIOD_H1;tf1 =PERIOD_H4;break; case PERIOD_M30: tf =PERIOD_H2;tf1 =PERIOD_H8; break; case PERIOD_H1: tf =PERIOD_H4; tf1 =PERIOD_H12;break; case PERIOD_H4: tf =PERIOD_H12; tf1 =PERIOD_D1; break; case PERIOD_D1: tf =PERIOD_D1; tf1 =PERIOD_W1; break; } //--- get MA's handles Ext1Handle=iCustom(NULL,PERIOD_CURRENT,"xxxx",SlowEMA1);//work ok Ext2Handle=iCustom(NULL,PERIOD_M5,"xxxx",SlowEMA1);//work ok Ext3Handle=iCustom(NULL,PERIOD_M15,"xxxx",SlowEMA1);//work ok //below worked error! // Ext1Handle=iCustom(NULL,PERIOD_CURRENT,"xxxx",SlowEMA1); // Ext2Handle=iCustom(NULL,tf,"xxxx",SlowEMA1); // Ext3Handle=iCustom(NULL,tf1,"xxxx",SlowEMA1);
not work for below code: so can not change period parameter on the fly!!!
Ext1Handle=iCustom(NULL,PERIOD_CURRENT,"xxxx",SlowEMA1);
Ext2Handle=iCustom(NULL,tf,"xxxx",SlowEMA1);
Ext3Handle=iCustom(NULL,tf1,"xxxx",SlowEMA1);
Good Afternoon !
Any idea why this is happening ?
Error in red @ the bottom left corner
Thank you
Files:
Capturar.PNG
95 kb
Found the problem:
Line 172 is incorrect.
Correct Value is: GetIndicatorsHandles();
File is !OnChartEvent.mqh

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
New article Change Expert Advisor Parameters From the User Panel "On the Fly" is published:
When developing complex Expert Advisors, the number of external parameters can be very large. And settings very often need to be changed manually, making the whole process very time-consuming, given a massive list of parameters. One can, of course, prepare sets in advance and have them saved, yet it may not be exactly what is required in some cases. This is where MQL5 comes in handy, as it always does.
Let us try to create a user panel that will allow us to change parameters of an Expert Advisor "on the fly" while trading. This may be relevant to those who trade manually or in semi-automatic mode. Upon any change made, parameters will be written to a file from which they will then be read by the Expert Advisor to be further displayed on the panel.
Author: Anatoli Kazharski