Data exchange between Indicator and EA

 

Hi,

I have a beginner's question. What is the preferred way of exchanging information between an indicator and an EA?

To be more specific, I have a custom Indicator that looks for candle patterns, and depending on what pattern is detected, I want to use different Trendindicators for filtering.

First I thought i could add an other buffer and put the pattern name as string in it, but buffers can only take doubles.

So what is the best approach of doing this?

Thanks,

Marley

 
Does really nobody have an idea how to solve this?
 
Take the double output and translate it so that ea can use it as its guide.
 

You can probably assign a number to each pattern and and store the number in a buffer.

Maybe use #define to make it easier to keep track of your numbers in the code

#define HangingMan    1.0



if(condition)
buffer1=HangingMan;

 Then in your EA

double pattern=iCustom(....)
if(pattern==1.00)
   {
   //code to deal with a hanging man
   }

 If a lot of different patterns, probably best to use a function and switch

 

Great, thanks!

Sometimes things are TOO easy...

 
GumRai: Maybe use #define to make it easier to keep track of your numbers in the code
Don't use #define, use an enumeration so it's self documenting.
enum Patterns = { HangingMan, ...};
:
if(condition) buffer[i]=HangingMan;

// Then in your EA

enum Patterns = { HangingMan, ...};
double pattern=(Patterns) iCustom(....)
if(pattern==HangingMan) ...

Detailed explanation of iCustom - MQL4 forum