Sma hcl

Simple Moving Average, High Close Low

Hi
I am unfamiliar with MQL coding and have a basic understanding of CTL (dealbook360/tradestation).
I’ve been paper trading the following rules and would like to know if anyone can try putting it into an EA for MT4.
It is only basic at this stage however I am thinking of adding take profit and stop loss levels, and maybe other indicators in the future.

I have manually tested it on a 1day chart and a 1 hour chart and both have given good results however I have only managed to test it over a short period.

At this stage I would just like the following written.

EA will buy when the average of the last 5 close, high and low prices are starting an uptrend.

buy
if current bars ma5close is higher than previous bars ma5close
if current bars ma5high is higher than previous bars ma5high
if current bars ma5low is higher than previous bars ma5low
sell
if current bars ma5close is lower than previous bars ma5close
if current bars ma5high is lower than previous bars ma5high
if current bars ma5low is lower than previous bars ma5low

Please post any code you can come up with so others can try fixing it if needed.