Download MetaTrader 5

How to obtain indicator values

To add comments, please log in or register
Publish your article and thousands of people all over the world will read it!
Giuseppe
18
Giuseppe 2016.02.03 12:17 

Hi guys,

I have this indicator (MBFX Timing) and I'd like to take a signal when it change color. If I use the iCustom function it gives me just the value, is there a way to take the colour of the line?

Thank you! 

 .

honest_knave
Moderator
2213
honest_knave 2016.02.03 12:25  

The colors will most likely correspond to different buffers.

If you open data window (CTRL+D) and move your crosshairs over different sections of the line you should be able to figure out which buffer relates to that color.

Giuseppe
18
Giuseppe 2016.02.03 12:39  
honest_knave:

The colors will most likely correspond to different buffers.

If you open data window (CTRL+D) and move your crosshairs over different sections of the line you should be able to figure out which buffer relates to that color.

Thank you! I already know which buffer is related to the different colours. My problem is to obtain the color from the EA.

honest_knave
Moderator
2213
honest_knave 2016.02.03 12:55  
Sweps:

Thank you! I already know which buffer is related to the different colours. My problem is to obtain the color from the EA.

Normally, it should be different buffers for different colors - you can't create a multicolored line in MQL4. This effect is made with 3 different lines all colored differently.

Sometimes it is as easy as checking if the buffer != EMPTY_VALUE and you know that color is active. 

Let's say there are 3 buffers.

Buffer 0 is the red color, Buffer 1 is the green color, Buffer 2 is the yellow color.

If Buffer 0 == 1.27 while Buffers 1 and 2 are empty, then the line is red.

If Buffer 1 == 1.27 while Buffers 0 and 2 are empty, then the line is green.

If Buffer 2 == 1.27 while Buffers 0 and 1 are empty, then the line is yellow. 

I hope that makes sense 

Giuseppe
18
Giuseppe 2016.02.03 13:14  
honest_knave:

Normally, it should be different buffers for different colors - you can't create a multicolored line in MQL4. This effect is made with 3 different lines all colored differently.

Sometimes it is as easy as checking if the buffer != EMPTY_VALUE and you know that color is active. 

Let's say there are 3 buffers.

Buffer 0 is the red color, Buffer 1 is the green color, Buffer 2 is the yellow color.

If Buffer 0 == 1.27 while Buffers 1 and 2 are empty, then the line is red.

If Buffer 1 == 1.27 while Buffers 0 and 2 are empty, then the line is green.

If Buffer 2 == 1.27 while Buffers 0 and 1 are empty, then the line is yellow. 

I hope that makes sense 

 


 

Yes it does, thank you! I'm just having problem reaching the values of the buffers. I mean, for what I know the only way to take indicator values from EA is through the iCustom function:

This is what i tried:

MBFXTGreen = iCustom(NULL,0,"MBFX Timing",param1,param2,0,0); 

MBFXTYellow = iCustom(NULL,0,"MBFX Timing",param1,param2,1,0);

MBFXTRed = iCustom(NULL,0,"MBFX Timing",param1,param2,2,0); 

I've understood that is the second to last parameter which select the buffers.

But actually I can't get the correct values. Am I doing something wrong? 

Giuseppe
18
Giuseppe 2016.02.03 17:19  
Problem solved. Thanks! :)
To add comments, please log in or register