EA doubt

 

Hi!

We're building an EA that uses two custom indicators. One indicator is running using D1 and Another together the EA is running on M30. The problem is that we are getting signals from D1 and searching for good points with M30. When we try to get the value using:

[code]

iCustom(Symbol(), PERIOD_M30, 'MyCoolIndicator',0,0) // we got just the last value of this indicator.

[/code]

Trying to find the best result we are searching for the good point in the last 30 positions:

[code]

for (int i=0;i < 30; i++)

{

if (iCustom(Symbol(), PERIOD_M30, 'MyCoolIndicator',0,i) == MY_EXPECTED_VALUE) return(true)

}

[/code]

How can I solve this problem using a statement like the first?

Is it a kind of MultiTimeFrame Paradigm?

Is It a syncronism error?

 

Use the second method.

 

It doesn't answer my question.

I need to understand what's happen. How can I control this? I'm using a random number 30 and I need to do it exactly.

How can I find the EXPECTED that only belongs to the current bar?

The problem is that sometimes I run my "finder" and I got the EXPECTED value from unexpected bar. I need to replace the "30" number with the correct function that returns how many elements I need to search on this bar....

How can I do that?

 
You cant get bar 0 data in the tester except for the chart timeframe.
 

Ok!

How can I do that?

Reason: