How to get access from my expert advisor to calculations of other indicators

 

just started to learn and experiment with mql.

here is the problem, for example i put onto charts lets say Moving Average and other indicators and my EA

how can i find out through my expert advisor what is current MA price, or any other param of any other indicator?

i could copy paste source code from MA mql file, but it is not practical and time consuming

what if i have to use 5 indicators and some are not open source?

any hint to solve this "problem" :))

 
 

Right on the money!

Combined Use of Programs


It was said earlier that according to MQL4 rules trade functions cannot be used in custom indicators, that is why for automated trading Expert Advisors or scripts should be used. However, the resource-saving technology used for calculations in indicators (see Creation of Custom Indicators) is widely used when creating trading programs. In most cases in custom indicators one can efficiently calculate values of indicator array elements necessary for the formation of trading criteria and making of trading decisions in Expert Advisors.

Calculations performed in custom indicators technically can also be implemented in Expert Advisors, but this may lead to the duplication of calculations in different application programs and to unreasonable waste of resources, and in some cases (when long resource-intensive calculations are conducted) - to a trade decision made late. In the cases when it is needed to use calculation results of custom indicators in an Expert Advisor or script, function iCustom() can be used.

Function iCustom()

double iCustom(string symbol, int timeframe, string name, ..., int mode, int shift)

Calculation of the given custom indicator. The custom indicator must be compiled (.ex4 file) and located in directory |b>Terminal_catalogue\experts\indicators.

Parameters:

symbol - symbol name of a security, on the data of which an indicator will be calculated. NULL indicates the current symbol.

timeframe - period. Can be one of chart periods. 0 means the period of the current chart.

name - name of the custom indicator.

... - List of parameters (if needed). Passed parameters must correspond with the order of declaring and the type of external variables of a custom indicator.

mode - Index of an indicator line. Can be from - to 7 and must correspond to the index used by any of SetIndexBar functions.

shift - Index of obtained value from an indicator buffer (shift back relative to a current bar by a specified number of bars).

 

eurgbp:

how can i find out through my expert advisor what is current MA price, or any other param of any other indicator?

iMA and iCustom
Reason: