Moving breakout (MB)

Hi,
I need help to automate the following strategy.
I have done manual testing on M5 and M15 data with AUD/USD which shows profitable results however need it coded so I can run it over a longer period.
At this stage there are no TP/SL however may incorporate this later.
Anyone with MQL programming experience who could code this would be a great help.
Thanks

INDICATOR
draw line at high and low if high minus low is equal or more than 10 pips

(run for each candle, if new high and low lines are made delete previous lines)

STRATEGY
Buy
if candle closes higher than high line AND
if short OR no trade is in place
close trade if price closes below low line

Sell
if candle closes lower than low line AND
if long OR no trade is in place
close trade if price closes above high line

(Don’t hesitate to ask any questions)

What is the purpose of deleting previous lines ?
If you do this would be the scenario:
High and Low of candle reaches ten pip difference, lines are drawn at those levels.
Price increases or decreases by 1 pip
Candle is now higher than the high line by 1 pip or lower than the low line by 1 pip.
So you now delete pervious lines and redraw new lines at the new level making an 11 pip difference.
If you do this all the way to the close, the close price cannot get higher or lower than the lines
Therefore you never get a trade

Here it is on EU its got big open draw down. this is a quick test.

Shrek did you do the test to trade if the lines were 10 pips apart and the close price was outside the lines or did you increase the distance between the lines as the price bars got larger ?

at least a 10 pip range on the bar then trade if the next bar breaks the high or low trades are at next bar open. no SL or TP just a quick test. I dont think the trades opened at the hi lo but on the next bar open if it was broke. I didnt save it.

Ok, keep the lines there.
There was no reason to delete them.

Here it is on EU its got big open draw down.

She1k what time frame did you use and when you say EU are you referring to EUR/USD?
I can only view the ‘Account Statistics’ of your post from my moblie, my computer says ‘Daily bandwith limit exceeded’ where image should be.

funny I was just working on this. I am getting much better test on the m15. I may post the rules I am testing tomorrow if anything shows promise.