I'm actually programming an EA who should by or sell if he is above or below a specified line. The prices for the specified lines I'm getting with this code:
The nice thing is, that if a new Bar is appear, MQL is counting it. So it is much easier to implement this!But I have one problem and I don't know, how I can solve this!
Namly, how can I check in real time, if the market already broken out?Because if the market did already broken out, the EA isn't allowed to trade anymore. He should only be allowed to trade at the break out. But not if the price is some where else and the buy/sell conditions are true. So I need one bool who is setted true, if the market did already broken out, so that the EA is not allowed to trade anymore.
Does anybody has an idea, how I can implement that?
Greetings and Thank You!
I am a bit confused by your code. Maybe it is due to poorly named variables
lowest and highest are datatime values but their names suggest that they are shift indexes. Would startTime and endTime be more self descriptive?
leftToShiftLowest changed to leftToShiftStart and leftToShiftHighest changed to leftToShiftEnd or something similar
Anyway, still using your confusing variable names, you could try something like this
What is your code doing? - I don't getting the sense...
I want to make sure, that the EA is only trading the break out and if it has already broken out and the Buy/Sell conditions are true, the EA should check, if the market has already broken out and if yes, the EA is not allowed to trade, though the conditions are true!How can I do that?
What don't you understand?
then put something in here