To sum up:
- There's api for Metatrader 3, but it's discontinued.
- There's no api for Metatrader 4.
- Dukascopy.com provides API but they requires some deposit.
- Oanda.com also provides API but they charges $600/month. (discount's available)
- Forex.com (Gain Capital) has free API.
- FXDD.com has API too. Not sure whether it's free.
You should email the brokers that you're interested. They will provide detail info.
Besides API, you can automate systems by coding in script. Metatrader has scripting engine that allows traders to automate their systems. Search for MQ4 tutorials (i'm doubt there's any). Scripting in metatrader 4 is popular. You can see lots of automated systems (so-called experts) in this systems forum.