My boss has a jewelry workshop and because of his job he must keep a large money in his account (as some kind of insurance and guarranty for other companies). Recently he heard of trading using softwares and decided to do something with that money. He asked me (as the programmer) to write an Expert Advisor in Metatrader software that buy and sell gold automatically on Forex exchange market to make some profit.
First of all, I don't know where to start. I read Metatrader API and write some codes which buys and sells on a Demo acoount. But I guess programming knowledge is not enough. Should I read some financial books? How about some statistical knowledge?
Second, it is clear that there is no promised and perfect strategy for making profit (even small) in the exchange market, because the profit of one guy comes from loss of another guys. No matter what strategy you use, some day you will be bad luck guy.
I seems there is a trade-off between taking the risk and making profit/loss in the exchange market. I hope I would find some strategy that makes a small profit with low risk.
Just like putting money in the bank that gives you small profit with no-risk, there should be a stategy in the exchange market which gives you a little more profit with a low level of risk.
Do you know any low-risk small-profit strategy for trading in Forex?
Having worked in the field for a couple of years, I can tell you: Algorithmic trading is complex and sometimes unpredictable, prone to gaming by other parties out there on the electronic battlefield and if you don't know what you're doing, you WILL LOSE MONEY and your boss will probably not like it.
The buy/sell API is as easy as picking up the phone and screaming "buy/sell" at your broker. Knowing when to do that and by how much... that's what separates the men from the boys as the saying goes.
I'd be very cautious if I were you. Build trading applications requires much more than a programmer. It requires a programmer/trader. If you're not one, you'll lose.
To be honest, the other answers here are 100% correct--if you don't know what you're doing here, and from your question it sounds like you don't, you're going to be the fool that everyone else gets rich off of. As Paul Newman said, "If you're playing a poker game and you look around the table and and can't tell who the sucker is, it's you."
But I don't want to send you away without an answer. Essentially, the answer to your question lies in a field called Portfolio Theory. Portfolio theory is the mathematical underpinnings of the theory of the relationship between risk and rate of return. There are books about it and it is taught in universities. Most of the people who know how to do it learned it by working on Wall Street, in investment banks, or hedge funds.
There is no trivially easy answer here ... essentially your question is the same as saying "I want to take my appendix out. It's been hurting. How can I take my appendix out?" And the best answer we can come up with is, "Find a doctor or go to medical school."
First off, forex is for trading currencies, not metals. If he wants to trade commodities like gold, you should be looking at the futures markets.
Second, you're swimming with sharks, with laser beams. You're going to be up against some of the worlds brightest people who are thinking about this 24 hours a day and have been doing so for 10, 20, 30, 40 years or longer.
I'm not saying it's not possible, but I will say that it sounds like your boss has unrealistic expectations and if you chose to attempt this you've got your work cut out for you.
I am a quantitative analyst in a Tier 1 bank.
What you are asking is totally off-topic for this website. Ideally, you want to be a guru in statistics, econometrics and having trading experience. To be honest, programming is the least important parameter in this venture.
I am not saying you cannot succeed without these skills but many people are under the illusion of being successful while they are trading noise.
It is very hard to have a real edge against the market and even if you have one to quantify it statistically correctly.
If you still want to pursue your quest, you should learn how to backtest properly your strategy (meaning measure on historical data what would have been the profit), do some forward testing and then implement it. I know a few people involved in this kind of work in funds and it is not uncommon for them to forward test a strategy for 1 year before to even think about going live. Do not forget to include the cost of capital and learn how to size your positions using sound money management.
Do not forget to compute your edge statistically using a large number of trades. Many people think they have an edge and just got lucky ...
First of all, your question is not "How to write a program for forex market". That can be done easily. The question is "How do I predict the movement of gold prices accurately enough so that I can profit from it".
Second of all, If anyone knew a low risk small profit strategy, they wouldn't tell you for free.
You have to learn The Metaweb Query Language (MQL4 OR MQL5). But it takes years and lots of time to write your own bot and actually to get some real profits. It's easier to trade manually, human can see more patterns and read the news than the bots (which can't predict economical changes) or use some existing strategies which were already tested for couple of years on the REAL accounts.
The are existing bots on the market, thousands of them, so start from there.
First of all download MetaTrader4, then download all Expert Advisor you can find on the internet and play with them. Learn how to do strategy backtesting, change some variables and learn how it works based on the code. Basically you need experts with MQ4 extension which contains the source, if you get EX4, then it is encoded (with possibility to decode).