How to transfer the value of a variable from custom indicator to EA?

 

Hi,i am a beginner in MQL4, i need help.


I have a custom indicator, and inside i have a variable of type bool or double.

I'm trying to get the value of a variable from custom indicator to EA, but I'm not able to. I've tried it through the iCusom feature, but I can't. I have no idea where to go.

Both the indicator and the EA must run in parallel in one chart.


I need advice on how to transfer value, I don't even know if it's possible this way. I have no idea how to do it.

Please help, thanks.

JB

 
  1. Why did you post your MT4 question in the MT5 General 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.

  2. iCustom only reads buffers. Add a buffer (visible or not) and read it.

  3. Store it in a Global Variables of the Terminal so anyone can read it.

  4. Write a File Functions

 
William Roeder #:
  1. Why did you post your MT4 question in the MT5 General 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.

  2. iCustom only reads buffers. Add a buffer (visible or not) and read it.

  3. Store it in a Global Variables of the Terminal so anyone can read it.

  4. Write a File Functions

I am sorry, i'll get that on right place next time.

Thank you, i'll try that by Global Variables.

 
William Roeder #:
  1. Why did you post your MT4 question in the MT5 General 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.

  2. iCustom only reads buffers. Add a buffer (visible or not) and read it.

  3. Store it in a Global Variables of the Terminal so anyone can read it.

  4. Write a File Functions

I tried to make a simple script and create a global variable, but when I put it on the platform, variable doesn't load.

Do I have an error in the code? I am attaching the code, please help me. I really don't know, thank you.

Files:
globalvar.mq4  3 kb
 
Jan Naj #:

I tried to make a simple script and create a global variable, but when I put it on the platform, variable doesn't load.

Do I have an error in the code? I am attaching the code, please help me. I really don't know, thank you.

I already figured it out.

It works, thanks.


 
Jan Naj #: I already figured it out.

Don't do that. Someone searching might find this thread and still be clueless. What was the problem? What solved what?

How To Ask Questions The Smart Way. (2004)
     When You Ask.
          Follow up with a brief note on the solution.

 
William Roeder #:

Don't do that. Someone searching might find this thread and still be clueless. What was the problem? What solved what?

How To Ask Questions The Smart Way. (2004)
     When You Ask.
          Follow up with a brief note on the solution.

Of course, I used a Global Variable, specifically the functions GlobalVariableSet in custom indicator (in this case the panel with buttons) and GlobalVariableGet in EA.

I didn't have to use the iCustom function at all for such a simple thing.

This is enough to easily transfer a variable from the custom indicator to the EA (or vice versa).

It would be possible to use File Functions, but Global Variables are enough in this case and easy to use.
Reason: