Download MetaTrader 5
To add comments, please log in or register
Have you developed a trading robot? Publish it in the Market and make profit!
Hans
17
Hans 2014.12.16 12:43 

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

Hans
17
Hans 2014.12.18 08:09  
Does really nobody have an idea how to solve this?
SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI 2014.12.18 08:41  
Take the double output and translate it so that ea can use it as its guide.
Keith Watford
Moderator
8010
Keith Watford 2014.12.18 08:47  

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

Hans
17
Hans 2014.12.18 09:34  

Great, thanks!

Sometimes things are TOO easy...

whroeder1
13644
whroeder1 2014.12.18 18:07  
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
/
To add comments, please log in or register