GlobalIntelHub2

How to build automated systems

Articles

By Joe Gelet

October 1, 2009

http://m.futuresmag.com/2009/10/01/how-to-build-automated-systems

More and more traders, institutional and retail alike, are trading short-term algorithmic strategies. These strategies often rely on speedy execution. Strategies also can be enhanced with dynamic allocation and risk management models that model well but depend on constant monitoring if executed manually. While every strategy does not need to rely on complete automation, the more processes that can be automated, the more time you will have to look for other opportunities. This is particularly true with forex trading.

Forex traders face a plethora of problems when developing and implementing any forex trading system. The difference between an amateur and a professional trader is having a robust trading plan, commonly known as a trading system. The system doesn’t necessarily have to be automated, all “system” means is a set of rules that traders follow. Without rules, traders are destined for failure as they become emotional, hungry, sleepy, and greedy.

The great metaphor for trading is war. Trading is a form of economic warfare where the winners go home with resources and the losers are economically killed and left with no resources. Traders should read “The Art of War” by Sun Tzu for more detail about military strategy.

The military, like it or not, is the most robust and sophisticated organization in the world. The military deals with complex political and logistics issues, such as moving 100,000 soldiers to a foreign country, all of whom have human needs such as eating, washing, communicating, relaxing, etc. Military computer systems need to function under heavy fire, in rugged terrain, and under stressful conditions. Military planners plan for many possible scenarios and create documentation in the form of manuals that soldiers read and follow. The reason for this is simple and functional: qualified analysts and policy makers shape plans that are executed on a tactical level. Soldiers should not think about what they are doing, and neither should traders. Planning and analysis can take weeks or months, in the quiet peace of contemplation, not while a trader has positions going against him. A trading plan is equivalent to an automated trade system; quantitative trading systems are simply the automatic execution of a well- planned trading plan, commonly referred to as a trading strategy.

Whether or not a trading strategy is fully automated is not important. What is important is that it is robust, considers many possible scenarios, is tested in real market conditions and can be executed as planned for. Traders need to equip themselves with all the tools to succeed. Some strategies need to be automated, at least partially, to be executed consistently.

Similar to military instruction manuals, a trading plan should be described so that any trader should be able to follow it, not just the plan’s author. The ultimate trading strategy is a fully automated trading strategy. In the end of this article, we provide a fully automated “expert advisor” trading strategy for download and use on the Meta Trader 4 platform. This strategy is a shell, or template system, that can be modified or used in multiple setups.

FOREX DAY-TRADING SYSTEMS

Traders must distinguish between types of systems. A system is a set of rules that can be executed by an automated algorithmic trade robot, or it can be executed by a human. A discretionary system, where a trader takes a fundamental position on the market, can also be executed by an automated algorithm. In fact, some of the best systems are a mix of discretionary and systematic. There isn’t any intelligent trading system that is publicly known, so any automated system requires correct execution by the trader and an understanding of the markets.

HOW TO CREATE A SYSTEM

First, you must find rules you want to follow. The rules must be based on quantifiable variables, not necessarily based on the charts. For example, if the EUR/USD increases by 1% (roughly 100 pips), then buy with a 0.25% stop and a 2% profit target. Any entry order should have an exit rule attached to it. A system should be comprised of several components:

• Indicator or suite of indicators that will determine buy/sell levels

• Exit strategy and trade management strategy

• Risk management that both manages the individual risk of each trade and the overall risk of the account.

A forex system does not necessarily have to be fully automated. It can be mixed or utilize discretionary input. Some systems take support and resistance levels from published sources and use this for entry and exit points. In other cases, traders may take a position that EUR/USD is declining, and load a system that will sell the EUR/USD dynamically by entering and exiting multiple orders based on a complex order entry algorithm.

TRADING CONDITIONS

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.

ELITE E-FIBO TRADER

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: http://efibo.eesfx.com.

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.

The post How to build automated systems appeared first on Forex IQ.

Print Friendly, PDF & Email
0 0 votes
Article Rating
Subscribe
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments