Is there a way to get the bar that an indicator was called for

 

Is there a way to get the bar index for which an indicator was called for from an ea ?

(besides writing to a file and having the indicator pick it up)

 
 Lorentzos Roussos: Is there a way to get the bar index for which an indicator was called for from an ea ? (besides writing to a file and having the indicator pick it up)
Sorry, but I don't understand your question. Can you elaborate with examples or more details please?
 
Fernando Carreiro #:
Sorry, but I don't understand your question. Can you elaborate with examples or more details please?

Moderator ? Congratulations .

I posted in the wrong section sorry . Its for mql4.

When i call iCustom(...,...,..,i)

Is there a way to know the "i" (bar index called to return a value for from a buffer) from within the indicator?

So if i call iCustom("MyIndicator",params,buffer,bar); can i get the bar in the indicator ?
 
Lorentzos Roussos #:

Moderator ? Congratulations .

I posted in the wrong section sorry . Its for mql4.

When i call iCustom(...,...,..,i)

Is there a way to know the "i" (bar index called to return a value for from a buffer) from within the indicator?

Pass it as a parameter.

 
Lorentzos Roussos #: I posted in the wrong section sorry . Its for mql4.

I have moved the thread for you!

 
Lorentzos Roussos #: When i call iCustom(...,...,..,i) Is there a way to know the "i" (bar index called to return a value for from a buffer) from within the indicator?So if i call iCustom("MyIndicator",params,buffer,bar); can i get the bar in the indicator ?

It seems that Alain understood your question, but I still don't follow. Sorry!

If you are specifying "i" as the "bar index" then you already know the "bar".

 
Fernando Carreiro #:

I have moved the thread for you!

thanks

Alain Verleyen #:

Pass it as a parameter.

ow , of course . thanks 

 
Fernando Carreiro #:

It seems that Alain understood your question, but I still don't follow. Sorry!

If you are specifying "i" as the "bar index" then you already know the "bar".

Yeah he did , i'm running a "manual" test and i want to get an indicator's state as "it would have been" back then, so i want to restrict the calculation up to a bar .

 
Lorentzos Roussos #: i want to get an indicator's state as "it would have been" back then, so i want to restrict the calculation up to a bar .

You are talking about a repainting indicator. They are useless for trading, IMO.

 
William Roeder #:

You are talking about a repainting indicator. They are useless for trading, IMO.

Yeah no disagreenment ,but its a zig zag type indicator so i want to poll the "waves" carefully as they would be at specific bars in the past . Its a point and click test so .