How to pass indicator value to expert advisors

Hello guys, can you tell me how I can pass the result of an indicator to an ea?

HPFZ_statistica is the indicator, I have to pass the value of the PronosticoFinale[MaxValue], in the expert advisor HPFZ_1.

p.s. At line 161 HPFZ_Statistica indicator is the value to be passed in the EA.

Files:

HPFZ_1.mq4 11 KB

HPFZ_Statistica.mq4 15 KB

Check out this link: https://book.mql4.com/samples/icustom for the basic stuff you need to include in your indicator, before it can pass values to an EA.

Thank you very much for your reply, I had read the help of the site, but my problem is to pass the value of the array, in EA. I made the change to create another array line 168. There are parameters to be passed but ICustom function, EA does not work.

Files:

HPFZ_Statistica.mq4 15 kb

You’ll have to somehow move the value you want to pass out to EA into an Indicator_Buffer - which the link I gave shows clearly how to declare and fill up. There is no alternative, unless you want to explore unconventional ways to pass values (e.g. passing via a data file)…

Alternative to that is to re-package your indicator into functions within your EA itself, or into a .mqh file, which you can then “include” into your EA and make direct calls to compute the values you want.

Thanks for your patience, I advice you to create 1 or 2 buffer?. The results of the indicator can be 2. O BUY or SELL

I created 1 buffer, for now

Files:

HPFZ_Statistica.mq4 16 kb

If your calculation results in 1 value per bar (different bars can have different values, no problem), then you’ll just need one buffer.

Thanks thanks a lot at line 210 is the value that the buffer returns, now I should write the iCustom function in Ea right? And I should give the result

Files:

HPFZ_Statistica.mq4 16 kb

Detailed explanation of iCustom - MQL4 and MetaTrader 4 - MQL4 programming forum

Check that your indicator runs without error first - look at terminal->experts to see if there’s any error message. After that will be iCustom function - should be straightforward.