Get Time Code for Chart

 

Hi,

I am writing an EA and am using a Custom Indicator in order to get from an M5 Chart

every 5 Minutes a value for a signal.


When running the EA, it runs everytime a tick arrives.
I get properly the value out of my Custom Indicator with iCustom,

but I want the EA to skip the code until really a NEW bar arrives.

I understood how to get up to 7 different indicator values using iCustom (so to speak the "Y" axis),

but how can I get the "X" values? The Index doesn't help as the newest bar is always "0".

Thanks for your help!

 
claudio_arrau2:

Hi,

I am writing an EA and am using a Custom Indicator in order to get from an M5 Chart

every 5 Minutes a value for a signal.


When running the EA, it runs everytime a tick arrives.
I get properly the value out of my Custom Indicator with iCustom,

but I want the EA to skip the code until really a NEW bar arrives.

I understood how to get up to 7 different indicator values using iCustom (so to speak the "Y" axis),

but how can I get the "X" values? The Index doesn't help as the newest bar is always "0".

The newest bar is bar 0 but it's Time[0] is different.
 

OK...but how can I get Time[0] from the Indicator to my EA?

With iCustom I only get the line values...

 
claudio_arrau2:

OK...but how can I get Time[0] from the Indicator to my EA?

With iCustom I only get the line values...

You don't need to . . .  just call iCustom() when you want a value and ask for the value for the correct bar,  if you want the value for bar 3 don't ask for the value for bar 0.  For example,  If you only want the value for bar 1 when a new bar 1 has formed then only call iCustom() when a new bar has formed and only ask for the value for bar 1.  
 
claudio_arrau2: OK...but how can I get Time[0] from the Indicator to my EA? 
You don't. Get the time from the TF you are using with your indicators. Time[] is the current chart. iTime() is from any chart. Search once per bar.
 

Sorry, am too dumb!

"Only call iCustom when a new bar has formed"....

this is exactly what I do not know how to find out.


What means "TF" WHRoeder?

What I want to to is that the EA initiates a trade only when a new bar in my indicator has formed.

 

Time Frame

 

:) Danke!

Geht jetzt....habs mit iTime(0,0,0) gemacht. Wenn iTime einen neuen Wert hat, dann ist der Bar fertig...

 
claudio_arrau2:

:) Danke!

Geht jetzt....habs mit iTime(0,0,0) gemacht. Wenn iTime einen neuen Wert hat, dann ist der Bar fertig...

This is an English Forum,  please post in English.   

 

Your code is incorrect,  please see the Documentation for  iTime(),  the first parameter is a string not an int.  If you want to use the current symbol use  NULL

 

Oh sorry, confused the languages...

it works now, with iTime(0,0,0)...when value in iTime changes, the Bar is created...

 
And if you want to use the current symbol and TF use Time[]
Reason: