Intersection of the indize with a certain value

 

Hi,

I want to write an EA whichs buys when die indzes goes from a lower point to the certain value (High[1]<=cerValue) and sell one order, if the indizes cuts the certain value from the higher point (Low[1]<=cerValue).

My problem is know, that the EA buys and sells more than one time at the same value. Or sometimes it doesnt sell or buy any order on the cerValue.

What did I wrong?

Does anybody knows an example how can I do that?

This would be great!!!!