I am new here, I decided I would like to create an Expert Advisor. I am busy getting familiar with MQL5 and it is going great! I thought I would start of by creating a simple MA crossover EA, and so far so good.
The problem comes in when I need to open a trade.
I want my EA to only BUY if the candle stick after the MA cross closes higher than the candle stick at the cross. and do the complete opposite for a SELL
I tried using priceInfo[-1].close but that obviously that doesn’t work. (“priceInfo” is the array for mqlRates)
So could this be solved with logic ? Or is there a method that I can use ? And if so any help would be appreciated.
Just a visual explanation:
In other words this is what I would like for a Buy:
And for a Sell: