Personal indicator variable to EA

 
Hello,

How to pass a variable from a Personal indicator to EA?
I've tried import or include, but don't get there...

Just to pass the values from chart to EA..

Thanks
 
You need Global variables - "MQL4: Global variables"
 
I', trying that, but still not working.

This in the indicator:
GlobalVariableSet("gv2",123);

This in the EA:
Print(GlobalVariableGet("gv2"));

Not working.
What's wrong?
 
Other words, you previously run custom indicator, and then run expert advisor on online chart?
 
Well, it was in the wrong place of the code... That's fine now.
But if there is a way of import the indicator as a function, so I can give it the values I want, that would be better.
As I make de iMACD(values..) for example.
How to define the indicator as function in this way?

Thanks
 
Of course! Use iCustom() - "MQL4: iCustom"
Reason: