Thursday, November 1, 2007

Adding Money Management Algorithm In My Expert Advisor (2)

I made good progress, today. I have opened a live metatrader account and am in the final stage of backtesting my EA using the history data of a live account.

I have also included an algorithm for risk and money management. Basically, the algorithm will help me decide on the trading lot size, which is calculated based on the account balance. As my trading account grows, so does the number of lots I trade. I have also added a risk control percentage which set the level of risk I willing to take on a single trade.

To include this money/risk management feature, the EA needs to overcome OrderSend error 131. The execution error occurs when an invalid volume(lot size) is being chosen for entering a trade. This is because the trading platform only allows trade size in the step of 0.1 (in the case of mini lots) or 0.01 (in the case of micro lots). 1 being the full lot size.

So, the trick is to use NormaliseDouble function to round up the lot size to 1 decimal point, so to comply with the step size of 0.1.

The checklist is complete, I think.

Related post:
Get to Know My Own Trading System (1)

No comments: