How to build automated systems

September 30, 2009 07:00 PM


Automated systems development is very dependent on the broker you work with. In the case of Meta Trader 4, each broker may have his own settings that will make the MT4 implementation slightly different. It isn’t enough to say that one is better than the other; they are all different. For example, there are limits on how close a stop loss can be placed to a pending order.


Fibonacci is a naturally occurring number also known as the “Golden Ratio,” which is used by traders to draw retracement levels on charts, timing entries and exits, and as is the case with the eFibo strategy, for lot sizing. The eFibo strategy has a basic indicator that determines trend or countertrend. In trending mode, eFibo adds lot sizes as the profit increases. In countertrend mode, it does the opposite, by selling into strength and buying into weakness and increasing the lot size as the loss increases. It can be used as an order entry technique for either a trending or counter trending strategy.

First a trader needs to determine levels for each new order after the initial position is entered in either a simple trend or countertrend strategy. This can be done by analyzing what is the highest high-low range for the past three trading sessions, and then adding 20%. The higher the range, the lower the chance your orders will quickly become too large. Finding the exact optimal setting is impossible because it is not possible to know how volatile the market will be tomorrow (even if using implied volatility) but you can set your strategy to match recent volatility to distinguish significant movement from noise.

If the highest range for the past three trading sessions on EUR/USD is 172 (1.4290 – 1.4118 = 172), this number can then be increased by a multiplier factor, which will allow for a larger range in case there is some news or event; 20% is a good number, but it could be as high as 30%: 172 * 20% (+172) = 206. Our assumption is that the pip volatility of the EUR/USD will not be greater than 206.

Next we determine how many levels deep we want to trade, which can be determined by lot sizes. Let’s stick with a conservative example that we do not want to use leverage. If we have a $100,000 account, with mini ($10,000) lots allowed, we could divide our account using a Fibonacci based model (see “Using math,” left).

In countertrend mode, that means we will buy at an initial level counter to the trend and add positions based on the Fibonacci sequence. If 1 = 0.1, by our fifth trade we would use only 0.8 lots per trade, which would meet our conservative criteria. Our total pip range, 206 divided by five which is the maximum level we want to trade, is 41.2. That means we enter a new trade every 41.2 pips. This is one of our most significant parameters (see “Scaled entry”). In our countertrend model, we would add to a long position based on the Fibonacci sequence every time we breach that level. While technically this is adding to a losing position, a red flag to many, no system picks absolute bottoms so a countertrend model will select a level where the market could be expected to correct and add to the position up to a reasonable risk management point as determined by our pip range.

The trending module is the same but in reverse, that means if the EUR/USD is going down, we would sell x lots every 41.2 pips, whereas with the countertrend module we would buy x lots every 41.2 pips. How we determine trend or countertrend can be based on two indicators as filters, or the trader can make the decision to buy or sell himself based on a fundamental view of the market.

The exit strategy for eFibo is simple; a stop loss is placed on each trade that is one half of the pip level, so in this example 20.6 pips on each trade.

A total trade take profit should be established, which will close the entire trade when $5,200 in profit is reached. We will be stopped out before this profit target is reached with a small profit or about flat, or the target will be reached. Strategy testing, optimization, and use will quickly teach traders what is the best amount to seek for profit.

The eFibo money management system will increase trading profits and reduce risks regardless of market direction, as opposed to a single buy/sell trade.

Finally, eFibo can be used on multiple pairs at the same time to maximize results. This reduces the chance that eFibo will be loaded in the wrong direction of the market, in addition to acting as a partial hedge. An example of this would be to execute it: long on GBP/USD, long EUR/GBP, short EUR/USD. This would be difficult to do manually, but is possible using an expert advisor (EA), an automated system that can be loaded on any chart and traded accordingly. Normally, an EA will trade the time frame of the chart that it is loaded onto. But since eFibo only trades off price, it can be loaded on any chart. The ability to automate this strategy is necessary to execute properly, while also watching multiple markets to find more opportunities.

Other systems can be downloaded free at the Elite e Services forum, which includes a manual and sample uses:

Joe Gelet is president of Elite E Services, a company that develops quantitative systems for the forex market. He has been trading forex since 2001 and programming forex systems since 2005.

Page 2 of 2
About the Author