Open - High - Bid - Ask?

 

Hi: Thanks for taking a look at my question. I am trying to get my robot to open trades only when the current price is within 20pips of the moving average, I am using a 30M chart for such. How can I express the current price without using LOW or HIGH? Is it possible to use Bid or Ask?

Thanks for any help.

 

The built-in Bid & Ask variables are the prices NOW - you cannot use them for historical prices. But, as it's for an EA, this is not a problem. Indeed, it is recommended that you use Bid & Ask.

I would also recommend that you examine some freely available EAs & see how they work - using Bid & Ask is only a small part of an EA. Things like opening, modifying & closing orders, as well as error recovery, usually make up a larger part of the code.

 

Many thanks!!!!!!!!!!!