a newbie questions

 

Hi Guys

i'm a newbie in MQ4 scripting so please bear with me.

I would like to implement an EA which takes inputs from a the Heiken Ashi custom indicator.

I understand that the function iCustom does just that. However, It gives me the data for the last bar only (bar with index 0).

How can i get the data for the bar with index 1, 2, etc...?

Is there a function which gives me the data from the custom indicator for all bars on screen?

example:

how can i get the Heiken-Ashi Open value for the last 4 bars?

Thanks Guys

Cheers

 

wasseem:

I understand that the function iCustom does just that. However, It gives me the data for the last bar only (bar with index 0).

How can i get the data for the bar with index 1, 2, etc...?

The last two arguments in the iCustom() call have always the same meaning:

The last argument is the bar number (0 meaning current bar, 1 is the bar before the current bar, 2 the bar before that and so on)
The second last argument is the so called "buffer number" for indicators that return more than one value per bar.

 
7bit:

The last two arguments in the iCustom() call have always the same meaning:

The last argument is the bar number (0 meaning current bar, 1 is the bar before the current bar, 2 the bar before that and so on)
The second last argument is the so called "buffer number" for indicators that return more than one value per bar.


Thanks 7bit,

about the buffer number, how do i know how the custom indicator maps the values it returns?

for example, how do i know if buffer0 contains the value for Heiken-Ashi open or close or high or low?

Thanks again

 
wasseem:


Thanks 7bit,

about the buffer number, how do i know how the custom indicator maps the values it returns?

for example, how do i know if buffer0 contains the value for Heiken-Ashi open or close or high or low?

Thanks again

If you put the indicator onto a chart and then open the data window you will see all buffers of the indicator, ordered by buffer number (It will display the names of the buffers if they are named but the order is always 0 is the first, 1 the second, etc.). If you move the mouse around on the chart you will see the values changing, it will show the values for the bar under the mouse. This is how I usually explore the contents and the correct working of indicator, where to find which value and if it is one of the arrow plotting indicators which buffer contains which arrows.


See this annotated screenshot for a detailed explanation:

http://www.forexfactory.com/attachment.php?attachmentid=409090&d=1265293038

 
7bit:

If you put the indicator onto a chart and then open the data window you will see all buffers of the indicator, ordered by buffer number (It will display the names of the buffers if they are named but the order is always 0 is the first, 1 the second, etc.). If you move the mouse around on the chart you will see the values changing, it will show the values for the bar under the mouse. This is how I usually explore the contents and the correct working of indicator, where to find which value and if it is one of the arrow plotting indicators which buffer contains which arrows.


See this annotated screenshot for a detailed explanation:

http://www.forexfactory.com/attachment.php?attachmentid=409090&d=1265293038


Very helpful,

Much appreciated mate.

Reason: