EA modification...

 

I found this EA on a blog somewhere. I kinda like it but for the fact that it opens very many trades. Basically, it opens a long trade if the previous candle was bullish or a short trade if the previous candle was bearish. Problem is that it keeps on opening new trades but doesn't close the existing ones. Can anyone help me modify the code so that only one trade exists at any given time.TIA

Files:
buysell.mq4  1 kb