Getting Ask or bid Prices on Script/EA (MT4)

 

Hi,

I'm trying to get  Ask/Bid updates from a Script/EA  using two moving averages. Here's the gist of what I want to do. 

Using the 20 and 50 ema, I want a way to check to see if the ask/bid goes back to the 50 ema or below then continue upwards/ downwards. 

(I want to check for pull backs / reversals  then continues in the trend and send a signal using the script/ EA).

Anyone has any ideas on how this can be done  ?