HOW to use iCustom() function for set value in drop down inputs of indicator setting

Mohammad Hasan Mosaddeqi
302
Mohammad Hasan Mosaddeqi  

Hi Everyone,

I want to use a indicator in an EA,

this indicator has some input settings that I want to change it by EA and then EA use it for take positions,

below picture is input settings of indicator,

indicator input setting window


my problem is How I can use iCustom function for set value of drop down menu?


for example How can fill ENTER SETTING OF INDICAROE in below code?

iCustom(Symbol(),TIMEFRAME,"Indicator Name", __ENTER SETTING OF INDICAROE__,0,0)
Marco vd Heijden
Moderator
13453
Marco vd Heijden  

Thats an:

ENUM_TIMEFRAMES

Chart Timeframes

All predefined timeframes of charts have unique identifiers. The PERIOD_CURRENT identifier means the current period of a chart, at which a mql5-program is running.

ENUM_TIMEFRAMES

ID

Description

PERIOD_CURRENT

Current timeframe

PERIOD_M1

1 minute

PERIOD_M2

2 minutes

PERIOD_M3

3 minutes

PERIOD_M4

4 minutes

PERIOD_M5

5 minutes

PERIOD_M6

6 minutes

PERIOD_M10

10 minutes

PERIOD_M12

12 minutes

PERIOD_M15

15 minutes

PERIOD_M20

20 minutes

PERIOD_M30

30 minutes

PERIOD_H1

1 hour

PERIOD_H2

2 hours

PERIOD_H3

3 hours

PERIOD_H4

4 hours

PERIOD_H6

6 hours

PERIOD_H8

8 hours

PERIOD_H12

12 hours

PERIOD_D1

1 day

PERIOD_W1

1 week

PERIOD_MN1

1 month

So you can fill in one of these parameters.

In the case of MQL4 there will be less then the above just look it up in the docs.
William Roeder
24607
William Roeder  
iCustom(Symbol(),TIMEFRAME,"Indicator Name", __ENTER SETTING OF INDICAROE__,0,0)
  1. On MT4: Unless the current chart is that specific pair/TF referenced, you must handle 4066/4073 errors before accessing prices.
              Download history in MQL4 EA - Forex Calendar - MQL4 programming forum - Page 3 #26 № 4

    The function linked to, opens a hidden chart for the symbol/TF in question (if not already open,) thus updating history, and temporarily placing the symbol on Market Watch (if not already there,) so SymbolInfoDouble(symbol, SYMBOL_BID) or MarketInfo(symbol, MODE_BID) don't also return zero the first call.

  2. You can't skip parameters in your iCustom call. Your image shows the first parameter is "Candle Trend Time Frames" a string (value likely irrelevant.) The second (2) through eight (8) parameters are the enumeration.
              Detailed explanation of iCustom - MQL4 programming forum

  3. Why did you post your MT4 question in the Root / MT5 EA section instead of the MQL4 section, (bottom of the Root page?)
              General rules and best pratices of the Forum. - General - MQL5 programming forum
    Next time post in the correct place. The moderators will likely move this thread there soon.

mjhv
6
mjhv  
hi. i use icustom  correctly but receive incorrect data . just receive value 10 for first symbol .if change symbol or change time frame receive 11 and if change another one increase number 12 , 13 , .... for each change symbol or time frame just number value increase and number value not relationship with correct value . please help? 
Keith Watford
Moderator
28953
Keith Watford  
mjhv:
hi. i use icustom  correctly but receive incorrect data . just receive value 10 for first symbol .if change symbol or change time frame receive 11 and if change another one increase number 12 , 13 , .... for each change symbol or time frame just number value increase and number value not relationship with correct value . please help? 

Then you are probably NOT using iCustom() correctly.

William Roeder
24607
William Roeder  
mjhv 11 and if change another one increase number 12 , 13 , .... for each change symbol or time frame just number value increase and number value not relationship with correct value . please help? 

You are using MT5.

Perhaps you should read the manual, especially the examples.
   How To Ask Questions The Smart Way. 2004
      How To Interpret Answers.
         RTFM and STFW: How To Tell You've Seriously Screwed Up.

They all (including iCustom) return a handle (an int). You get that in OnInit. In OnTick (after the indicator has updated its buffers), you use the handle, shift and count to get the data.
          Technical Indicators - Reference on algorithmic/automated trading language for MetaTrader 5
          Timeseries and Indicators Access / CopyBuffer - Reference on algorithmic/automated trading language for MetaTrader 5
          How to start with MQL5 - General - MQL5 programming forum - Page 3 #22 2020.03.08
          How to start with MQL5 - MetaTrader 5 - General - MQL5 programming forum - Page 7 #61 2020.07.05
          How to call indicators in MQL5 - MQL5 Articles 12 March 2010