Algorithmic and Mechanical Forex Strategies | OneStepRemoved

  • Articles
  • Sophisticated Web Sites
  • Automated Trading
  • Testimonials
  • Contact

How to Create a Synthetic Instrument In MetaTrader 5

January 2, 2018 by Shaun Overton Leave a Comment

The last version of MetaTrader required offline charts for anyone that wanted to create a synthetic currency pair or instrument. Since MetaTrader 5 still does not allow for offline charts, the ability to create synthetic time frames isn’t possible using the charting time series.

The new build 1640 for MT5 introduces the ability to create synthetic instruments. I, for example, want to watch VIX Calendar Spreads. Instead of just using my indicator, I also would like to see a chart that helps me track the calendar spread.

VIX calendar spread

A synthetic instrument chart displaying VIX Calendar Spreads

Market Watch MT5

How To Create A Synthetic Instrument Chart

Right click on the Market Watch window (look to the image on the right). You’ll see Symbols appear in a dropdown menu. Click on it.

Alternatively, just push Ctrl + U on your keyboard.

Create Custom Symbol MT5

Now enter in the Synthetic Instrument name. The name can be anything that you choose with allowed characters.

The most important step is to enter in your formula. As you can see in the image below, mine is a symbol subtraction. The primary keywords that you’ll use are bid() and ask(). So, if you want the bid of EURUSD, for example, you type in bid(EURUSD).

Finally, make sure to set the number of digits in your instrument. Otherwise, your chart will show a large number of unwanted, extra decimals.

Filed Under: MetaTrader Tips Tagged With: metatrader, synthetic, synthetic currency, VIX

My MT4 Expert Advisor Isn’t Working

February 12, 2015 by Shaun Overton 51 Comments

Your MT4 expert advisor isn’t working? Read through our checklist to help diagnose the problem. I want to get back to trading asap.

Dumb things you might not have considered (seriously)

Everyone gets annoyed when you call the cable company to complain that the cable isn’t working. What’s the first question that they ask?

Is your TV plugged in?

They ask that for a reason – people really do make those kinds of mistakes, so don’t feel frustrated that I’m pointing out potentially dumb mistakes.

Do you have MetaTrader 4 open and installed?

You must have MetaTrader 4 running in order to use an expert advisor. EAs cannot run with MT4 or the computer turned off.

Are you logged into your account?

If you don’t see a split red/green logo like the image below, it’s because you are not logged in to your account. It goes without saying that the internet is a prerequisite to trading online.

mt4 logged in

If you know that you’re entering the account information correctly, the next logical step is to test your internet. Are you able to open Google or another major web site in your browser?

Do you have money in your account?

You can’t trade if there isn’t any money in the account. Make a deposit in order to allow actual trading.

mt4 zero balance

If your account looks like this one… that’s bad.

Have you enabled AutoTrading?

You need to push the AutoTrading button so that it appears with a small green arrow.

MT4 autotrading

Do you see a smiley face on the chart?

sad mt4 expert advisor

If your EA shows a sad face like you see in the upper right corner of the image, it’s because EA trading is disabled

The smiley face is the proof that your expert advisor is allowed to place trades for you. If you see a sad face (as in the image above), then do one of the following

  • Check that AutoTrading is enabled (see the prior problem)
  • Right click on the chart. Choose Expert Advisors, then Properties. Right click on “Common” tab. Make sure the checkbox next to “Allow live trading” is checked.
Allow live trading

Check allow live trading to allow the EA to place trades.

Things that go wrong

Almost all of the items listed below will appear in the Journal tab if they occur. It’s the first place you should go if you’re still experiencing problems.

mt4 journal tab

Do you see any error messages in the Journal? This is the first spot to visit if you’re still trying to find the problem.

Your trades cannot enter

There are oh-so-many reasons why a trade cannot enter. You’re trying to buy at the sell price. Your pending order is too close to the market. There is not enough liquidity and the broker is unable to fill your order… or your broker is requoting you and refusing to accept your orders. If requotes are happening to you, then you really ought to switch brokers.

Check the journal tab to figure out the reason.

The brokers slippage is larger than the amount slippage you specified for the order

Most EAs contain an input for Slippage. If you specify a small amount and the broker is unable to fill your order at the requested price, then your trade will be rejected. You’ll know this from checking the Journal.

Context is busy

This is an error common to many EAs. If you’re trading both the EURUSD and GBPUSD and they generate signals at the same time, then one signal must wait.

MT4 does not allow sending multiple orders at the same time. In this scenario, the EA has to send the EURUSD order, wait for the broker to accept it and get the confirmation. Then and only then can it request to place the GBPUSD trade. Talk to a MetaTrader programmer if you’re experiencing this issue.

The price of your pending order is too close to the current market.

Solution: place it further away or get a new broker. You shouldn’t put up with restrictions on your trading.

A compile error has prevented MT4 from generating an executable file

This will prevent the EA from loading onto the chart. You’ll see a note in the Journal saying the EA was removed and it will give an uninitialization reason.

A logical error in the code is preventing the EA from taking trades at the right time

If you paid for an expert advisor and it’s not trading at the correct time, then contact our programmers.

I can’t use MT4 while the EA runs

Then the EA contains an infinite loop. You need to have this removed from your MQL4 source code before you’ll be able to use the expert advisor and MT4 at the same time.

A buy trade won’t enter while I have an open sell trade. Or… a sell trade won’t enter while I have an open buy trade

Your broker is more than likely in the US. You are trying to hedge, which means having an open buy trade and an open sell trade at the same time on the same currency pair. This is illegal in the US, so MetaTrader does not allow it.

My EA says something about a missing file

Some EAs, especially ones that you buy on the internet, require special files in order to run properly. Even one missing file will cause the EA to malfunction. These can include files, library/dll files, or a custom indicator. Missing also means that the file(s) is not located in the correct folder.

You haven’t enabled DLL permission

Check your DLL permission if you see this error. Right click on the chart. Choose expert advisors, then choose Properties. Click on the Common tab. Make sure you have a check next to “All DLL imports”.

Allow dll imports

You switched accounts or profiles

MetaTrader disables automated trading when you switch accounts or profiles. Click the big button at the top of your MetaTrader platform that says “AutoTrading”.

Your broker’s server is down

This should strike fear into the heart’s of every online forex trader. While most brokers have 99.99999% uptimes, it does rarely happen where a server goes down. If your internet is working and everything works except MetaTrader, then it’s time to call your broker’s customer service number.

Because you like trading with EAs, why not check out our free expert advisors? Click here to review the selection.

Can’t find the answer to your problem? Explain your problem in the comment section below to get an answer within one business day.

Filed Under: MetaTrader Tips

How To Win With Mechanical Trading Systems

March 18, 2014 by Eddie Flower 13 Comments

Much ink has been devoted to pinpointing the causes of mechanical trading systems failures, especially after the fact. Although it may seem oxymoronic (or, to some traders, simply moronic), the main reason why these trading systems fail is because they rely too much on the hands-free, fire-and-forget nature of mechanical trading. Algorithms themselves lack the objective human oversight and intervention necessary to help systems evolve in step with changing market conditions.

Mechanical trading systems failure, or trader failure?

Instead of bemoaning a trading-system failure, it’s more constructive to consider the ways in which traders can have the best of both worlds:  That is, traders can enjoy the benefits of algorithm-managed mechanical trading systems, such as rapid-fire automatic executions and emotion-free trading decisions, while still leveraging their innate human capacity for objective thinking about failure and success.

The most important element of any trader is the human capability to evolve. Traders can change and adapt their trading systems in order to continue winning before losses become financially or emotionally devastating.

Choose the right type and amount of market data for testing

Successful traders use a system of repetitive rules to harvest gains from short-term inefficiencies in the market. For small, independent traders in the big world of securities and derivatives trading, where spreads are thin and competition fierce, the best opportunities for gains come from spotting market inefficiencies based on simple, easy-to-quantify data, then taking action as quickly as possible.

When a trader develops and operates mechanical trading systems based on historical data, he or she is hoping for future gains based on the idea that current marketplace inefficiencies will continue. If a trader chooses the wrong data set or uses the wrong parameters to qualify the data, precious opportunities may be lost. At the same time, once the inefficiency detected in historical data no longer exists, then the trading system fails. The reasons why it vanished are unimportant to the mechanical trader. Only the results matter.

mechanical trading rules

Pick the most pertinent data sets when choosing the data set from which to create and test mechanical trading systems. And, in order to test a sample large enough to confirm whether a trading rule works consistently under a wide range of market conditions, a trader must use the longest practical period of test data.

So, it seems appropriate to build mechanical trading systems based on both the longest-possible historical data set as well as the simplest set of design parameters. Robustness is generally considered the ability to withstand many types of market conditions. Robustness should be inherent in any system tested across a long time range of historical data and simple rules. Lengthy testing and basic rules should reflect the widest array of potential market conditions in the future.

All mechanical trading systems will eventually fail because historical data obviously does not contain all future events. Any system built on historical data will eventually encounter ahistorical conditions. Human insight and intervention prevents automated strategies from running off the rails. The folks at Knight Capital know something about live trading snafus.

Simplicity wins by its adaptability

Successful mechanical trading systems are like living, breathing organisms. The world’s geologic strata are filled with fossils of organisms which, although ideally suited for short-term success during their own historical periods, were too specialized for long-term survival and adaptation. Simple algorithmic mechanical trading systems with human guidance are best because they can undergo quick, easy evolution and adaptation to the changing conditions in the environment (read marketplace).

Simple trading rules reduce the potential impact of data-mining bias. Bias from data mining is problematic because it may overstate how well a historical rule will apply under future conditions, especially when mechanical trading systems are focused on short time frames. Simple and robust mechanical trading systems shouldn’t by affected by the time frames used for testing purposes. – The number of test points found within a given range of historical data should still be large enough to prove or disprove the validity of the trading rules being tested. Stated differently, simple, robust mechanical trading systems will outshine data-mining bias.

If a trader uses a system with simple design parameters, such as the QuantBar system, and tests it by using the longest appropriate historical time period, then the only other important tasks will be to stick to the discipline of trading the system and monitoring its results going forward. Observation enables evolution.

On the other hand, traders who use mechanical trading systems built from a complex set of multiple parameters run the risk of “pre-evolving” their systems into early extinction.

Build a robust system that leverages the best of mechanical trading, without falling prey to its weaknesses

It’s important not to confuse the robustness of mechanical trading systems with their adaptability. Systems developed based on a multitude of parameters led to winning trades during historical periods – and even during current observed periods – are often described as ‘robust.’ That is no a guarantee that such systems can be successfully tweaked once they have been trade past their “honeymoon period.” That is an initial trading period during which conditions happen to coincide with a certain historical period upon which the system was based.

Simple mechanical trading systems are easily adapted to new conditions, even when the root causes of marketplace change remain unclear, and complex systems fall short. When market conditions change, as they continually do, the trading systems which are most likely to continue to win are those which are simple and most-easily adaptable to new conditions; a truly robust system is one which has longevity above all.

Simple algorithmic mechanical trading systems with human guidance are best because they can undergo quick, easy evolution and adaptation to the changing conditions in the environment (read marketplace).

Unfortunately, after experiencing an initial period of gains when using overly-complex mechanical trading systems, many traders fall into the trap of attempting to tweak those systems back to success. The market’s unknown, yet changing, conditions may have already doomed that entire species of mechanical trading systems to extinction. Again, simplicity and adaptability to changing conditions offer the best hope for survival of any trading system.

Use an objective measurement to distinguish between success and failure

A trader’s most-common downfall is a psychological attachment to his or her trading system. When trading-system failures occur, it’s usually because traders have adopted a subjective rather than objective viewpoint, especially with regard to stop-losses during particular trades.

Human nature often drives a trader to develop an emotional attachment to a particular system, especially when the trader has invested a significant amount of time and money into mechanical trading systems with many complex parts which are difficult to understand. However, it’s critically important for a trader to step outside the system in order to consider it objectively.

In some cases, the trader becomes delusional about the expected success of a system, even to the point of continuing to trade an obviously-losing system far longer than a subjective analysis would have allowed. Or, after a period of fat wins, a trader may become “married” to a formerly-winning system even while its beauty fades under the pressure of losses. Worse, a trader may fall into the trap of selectively choosing the testing periods or statistical parameters for an already-losing system, in order to maintain false hope for the system’s continuing value.

An objective yardstick, such as using standard deviation methods to assess the probability of current failure, is the only winning method for determining whether mechanical trading systems have truly failed. Through an objective eye, it’s easy for a trader to quickly spot failure or potential failure in mechanical trading systems, and a simple system may be quickly and easily adapted to create a freshly-winning system once again.

Failure of mechanical trading systems is often quantified based on a comparison of the current losses when measured against the historical losses or drawdowns. Such an analysis may lead to a subjective, incorrect conclusion. Maximum drawdown is often used as the threshold metric by which a trader will abandon a system. Without considering the manner by which the system reached that drawdown level, or the length of time required to reach that level, a trader should not conclude that the system is a loser based on drawdown alone.

Standard deviation versus drawdown as a metric of failure

In fact, the best method to avoid discarding a winning system is to use an objective measurement standard to determine the current or recent distribution of returns from the system obtained while actually trading it. Compare that measurement against the historical distribution of returns calculated from back-testing, while assigning a fixed threshold value according to the certainty that the current “losing” distribution of mechanical trading systems is indeed beyond normal, to-be-expected losses, and should therefore be discarded as failed.

So, for example, assume that a trader ignores the current drawdown level which has signaled a problem and triggered his investigation. Instead, compare the current losing streak against the historical losses which would have occurred while trading that system during historical test periods. Depending upon how conservative a trader is, he or she may discover that the current or recent loss is beyond, say, the 95% certainty level implied by two standard deviations from the “normal” historical loss level. This would certainly be a strong statistical sign that the system is performing poorly, and has therefore failed. In contrast, a different trader with greater appetite for risk may objectively decide that three standard deviations from the norm (i.e. 99.7%) is the appropriate certainty level for judging a trading system as “failed.”

The most important factor for any trading systems’ success, whether manual or mechanical, is always the human decision-making ability. The value of good mechanical trading systems is that, like all good machines, they minimize human weaknesses and empower achievements far beyond those attainable through manual methods. Yet, when properly built, they still allow firm control according to the trader’s judgment and allow him or her to steer clear of obstacles and potential failures.

Although a trader can use math in the form of a statistical calculation of standard distribution to assess whether a loss is normal and acceptable according to historical records, he or she is still relying on human judgment instead of making purely-mechanical, math-based decisions based on algorithms alone.

Traders can enjoy the best of both worlds. The power of algorithms and mechanical trading minimizes the effects of human emotion and tardiness on order placement and execution, especially with regard to maintaining stop-loss discipline. It still uses the objective assessment of standard deviation in order to retain human control over the trading system.

Be prepared for change, and be prepared to change the trading system

Along with the objectivity to detect when mechanical trading systems change from winners into losers, a trader must also have the discipline and foresight to evolve and change the systems so they can continue to win during new market conditions. In any environment filled with change, the simpler the system, the quicker and easier its evolution will be. If a complex strategy fails, it may be easier to replace than to modify it, while some of the simplest and most-intuitive systems, such as the QuantBar system, are relatively easy to modify on-the-fly in order to adapt to future market conditions.

In summary, it can be said properly-built mechanical trading systems should be simple and adaptable, and tested according to the right type and amount of data so that they will be robust enough to produce gains under a wide variety of market conditions. And, a winning system must be judged by the appropriate metric of success. Instead of merely relying on algorithmic trading rules or maximum drawdown levels, any decision about whether a system has failed should be made according to the trader’s human judgment, and based on an assessment of the number of standard deviations of the system’s current performance when measured against its historic-test losses. If mechanical trading systems are failing to perform, the trader should make the necessary changes instead of clinging to a losing system.

Filed Under: How does the forex market work?, MetaTrader Tips, Trading strategy ideas Tagged With: backtesting, expert advisor, forex, mechanical trading, risk management, standard deviation, stop loss, strategy

A New Look At Adaptive Asset Allocation

March 13, 2014 by Eddie Flower 6 Comments

Adaptive Asset Allocation (AAA) was born as one of several sibling strategies for applying Modern Portfolio Theory (MPT), which was first proposed in 1967 as a way to optimize portfolio gains. Yet, many traders and financial strategists who truly believe in the math of MPT are disillusioned because the real-world results while using AAA haven’t met their calculated expectations for gains, and the volatility of such portfolios has been higher than expected.

Recent studies of this topic have suggested that this mismatch between expectations and reality may be primarily due to the length of the time periods used for input averages and portfolio rebalancing: Apparently, when calculations are based on input data using averages obtained over much shorter periods of time, the portfolio returns are better than when those averages are calculated based on long-term numbers. And, when the portfolio rebalancing intervals are shorter, performance is better and volatility and risk are reduced.

To recap, MPT relies on 3 parameters to create ideal portfolios, typically involving a set of asset classes including stocks in the U.S., European, Japanese and emerging markets, plus U.S. and international REITs, U.S. long-term and intermediate Treasuries, as well as gold and other commodities. The parameters are:

  • Expected volatility
  • Expected returns
  • Expected correlation

It seems that using shorter-term averages for MPT scenarios leads to more accurate results. One shortcoming of the previous-generation allocation model, Strategic Asset Allocation (SAA), becomes apparent because that model applies MPT based on long-term averages regarding the above parameters. As detailed in the recent new work on this topic, using long-term averages leads to significant errors in calculated returns.

In practice, long-term averages over a 5-to-20-year time horizon are poor predictors of volatility, returns and correlation. The statistical gap between calculations using 20-year averages and those using 3-or-4-year averages with regard to stocks’ annualized returns is huge, ranging from negative returns to nearly 14%. Given the relatively short investment time horizons of most investors nowadays, it seems clear that using shorter-term parameters in the calculations will yield more realistic results.

Adaptive portfolio

Portfolios offer better risk adjusted returns when they adapt to short term market conditions.

To acknowledge reality without disavowing longer-term calculations entirely, some investors choose to tweak their calculations by applying a long-term value approach instead of a long-term average approach, which tends to weight portfolios in favor of equities when stock prices fall, and conversely to reduce weighting in equities as their prices become more expensive.

Yet, with advancing technology there are some new alternatives to using long-term valuation for “handicapping” the calculated returns. At the extreme end of the short-term horizon lie the high frequency traders, who take advantage of short-term trends, correlations and reversions-to-mean in order to generate more-realistic estimates of returns. There is currently much excitement in the trading community based on the success of traders who use HFT systems. Still, as more traders crowd into this niche, it’s possible that the spreads will thin or perhaps vanish altogether.

The predictive value of momentum

Momentum is an excellent way for investors to estimate performance over the short term. According to the old adage: The best predictor of short-term future price is the current price. And, as the investment horizon is extended from intraday or daily trading outward toward weekly periods, the effect of momentum becomes more noticeable. Perhaps due to larger, slower-moving investors, prices tend to keep moving in the same direction for several weeks. Given this probability, it’s logical to account for momentum when building a portfolio, regardless of the long-term averages already observed.

Volatility

Volatility, too, has been misapplied with regard to MPT. For example, although average long-term annualized volatility is about 20% for stock prices and about 7% for 10-year Treasuries, actual volatility measured during the shorter time horizons of most investors fluctuates much more wildly, and is therefore much less accurate for projecting future conditions. So, actual volatility can have a far more adverse impact on a portfolio than the calculated volatility implies.

And, although many investors attempt to roughly balance the difference in volatility between stocks and bonds by weighting portfolios with 60% stocks and 40% bonds, still, the actual volatilities experienced can far override such a crude balancing method. Therefore, with regard to volatility assumptions it seems safest to rely on the adage mentioned above, that is, the least-biased guess of tomorrow’s price is based on today’s price. Likewise, the least-biased guess of tomorrow’s price range is the price range during the recent past, which of course represents the recent volatility.

Since recent volatility seems to offer the best guess about near-term future volatility, and most investors have a short-term horizon, it seems logical to use short-term volatility as the parameter for MPT instead of long-term volatility. As a takeaway regarding volatility, a savvy investor rebalancing a portfolio can calculate its volatility and, in order to maintain the volatility risk at a stable level over time, could reduce exposure by partly moving into cash when volatility exceeds the targeted level.

Correlation & returns

Even though long-term correlations between the prices of asset classes such as stocks and Treasuries, or stocks and gold, are low or negative, over shorter time periods the actual correlations vary greatly. So, for example, the volatility of a 50-50 stock-and-bond portfolio may decrease by 50% as the correlation decreases.  

Similarly, although many traders intuitively understand that a portfolio’s risk is reduced by apportioning the volatility of its components, a less-intuitive observation from the recent studies has been that returns from risk-managed portfolios were also improved by as much as 25%. Finally, since the human nature of investors makes it difficult to focus on returns alone while disregarding risks, especially over a longer term when drawdowns may accrue, it’s also prudent to consider maximum drawdown along with volatility when seeking maximum returns.

Summary

If MPT scenarios based on near-term average values give more accurate estimates than those based on long-term values, then it seems best for HFT traders and other short-horizon investors to use current observed values for portfolio optimization. In the recent studies cited herein, the authors have advocated the monthly rebalancing of portfolios by using a true Adaptive Asset Allocation based on returns in the near term in view of their momentum, along with the appropriate short-term volatility and correlation averages.

One algorithmic approach might be to create fresh portfolios at the time of monthly rebalancing based on the top few assets according to six-month or even shorter momentum, and to allocate assets according to an algorithm specifying minimal variance in volatility, instead of apportioning each asset according to its individual volatility. This approach would account for the volatility and correlations among the top few assets in order to create a momentum portfolio with the least expected portfolio volatility, along with a palatable risk profile.

 

Filed Under: How does the forex market work?, MetaTrader Tips, NinjaTrader Tips, Trading strategy ideas Tagged With: AAA, adaptive asset allocation, modern portfolio theory, MPT

How To Create A Winning Trading System

March 11, 2014 by Eddie Flower 2 Comments

Many traders are attracted to forex because of the opportunities for fat gains, especially when compared with stocks. Yet, when trading forex the inherent leverage can affect traders’ emotions, leading to over-trading, loss-chasing and second-guessing. A mechanical trading system can provide the winning solution.

Why build a trading system?

Manual trading works well for many stock traders, especially those using buy-and-hold strategies for a limited number of favorite picks, yet forex traders need better tools and stronger discipline in order to be profitable.

In any industry, a well-built machine is more efficient than any human

A well-built mechanical trading system offers a trader the best of both worlds: technology and math give the trader the ability to spot and take advantage of market inefficiencies and harvest gains in a busy, cluttered environment, while freeing him or her from the emotional roller-coaster ride of trading.

Find your own niche

There are plenty of trading systems available nowadays; the key to forex trading success lies in finding or adapting the “right” system for your own needs and style. Once you’ve decided the parameters for success, including your overall goals and objectives for trading, personal tolerance for risk, and the amount of capital to be devoted to trading, a system can be built to fit you like a glove.

When building a system, there’s plenty of room for specialization and individualization – If everyone were trading the same way, spreads would soon disappear. Like fast-moving mosquitoes buzzing around a lumbering elephant, many traders earn an excellent living by capitalizing on opportunities inevitably created by the movements of much-larger players in the marketplace; the key is to gather an actionable set of patterns and indicators that fits your personal style.

If a pattern is noticeable, then it’s probably actionable

The first step is to search through past trading data in order to identify patterns and conditions which appear to consistently offer profitable trading opportunities. Historical price and volume charts often show patterns which appear to signal upcoming price moves, and technical indicators will help clarify an otherwise-fuzzy picture.

Try looking at different combinations of indicators over different historical time periods to see if they may give predictive power in spotting market turns or changes in trend. A “caveman-style” approach to quickly testing your hunches can be as simple as finding a noticeable pattern on a printed chart, then holding a sheet of paper over the upcoming section and “guessing” what will happen next; when you’re right, you may have found a winning pattern.

Testing & optimization

Once you’ve identified a fairly-predictable pattern by looking at charts, it’s time to think about how to trade it profitably. You should consider how it fits with your personal trading style, including risk management. The patterns and indicators upon which your system is based can be simple or complex, as long as they work in the marketplace and fit your circumstances.

How to create a winning trading system

The next step is to translate these patterns and scenarios into mathematical coding, to form a set of trading rules which can be fully tested. You can do this yourself, or you can rely on the services of a coding expert to help accomplish this. After you’ve created the foundation for a system, it can be tested objectively by changing the inputs to find the optimal conditions for trading, such as the best combinations of currency pairs, stops, and other variables.

You can use software to quickly test multiple combinations of indicators. The key is to identify predictable patterns which will give you the confidence to trade when you see them appear, whether long or short, then fine-tune them to maximize your gains. It’s important to realize that more complexity isn’t necessarily better – A super-complex system probably won’t fatten your wallet if it only signals a trade once every ten years and your computer happens to be offline when that finally occurs.

Don’t become married to your system

Most importantly, if your indicators aren’t working out during testing as you had hoped, don’t become emotionally invested in “proving” that they work. Instead, step back and take a broader look – Perhaps it’s time to use a different combination of indicators, or change your approach altogether.

During testing and optimization, it’s important to leave untouched some of your historical market data as untested “out-of-sample” data while you work through testing your system using in-sample data. For statistical purposes during testing, you can only use data once before modifying your system; then of course it becomes part of your in-sample data. If you contaminate your test data, that is, if you rely on a certain date range of data to first develop and test your system, then later re-test your modified system with the same data, the results may be skewed. So, use your out-of-sample data only for final testing and tweaking after you’ve built your system, so you can be sure that such data is “pure” and not already accounted for in the system.

Be sure to back-test any prospective new system over reasonably long periods, so you’ll have an idea how it performs long-term. And, check the results when using different lengths for your moving averages. Also, it’s worthwhile to test your system widely across different forex pairs, even those you don’t typically trade – You may be surprised to find that your system does especially well in a market that you haven’t tried before.

Implementation

Even though testing and minor tweaking should be thought of as an evolutionary process that continues during the life of your trading, at this point you’re ready to implement your system by using it to trade with real money. If you’ve done your homework well, and you stick to the rules that your testing has proved will work under specific conditions, then you’ll be confident in proceeding forward.

Stick to the proven rules and you’ll be successful

Societies rely on laws to govern the behavior of their citizens because they’ve learned over time (tested and optimized) what works. Likewise, in order to be successful with forex you should adhere to the consistent trading rules that you’ve established in a scientific manner. If you stick to the rules, your mechanical trading system can help you win the forex game.

Filed Under: How does the forex market work?, MetaTrader Tips, Test your concepts historically Tagged With: indicator, leverage, mechanical, out-of-sample, risk management

MetaTrader Code Breaking Changes

February 6, 2014 by Shaun Overton 4 Comments

A client just called comparing the newest MetaTrader update to Obamacare. Given the number of phone calls that I’ve fielded today, that sounds about right.

The most common issue is that expert advisors and indicators don’t show up inside of MetaTrader. Clients swear up and down that the files are in the right spot, but MT4 can’t find them for some reason.

You have one of two issues:

  1. Your files are not in the right spot. This update to MT4 migrates the new experts folder to a completely different path. The new path is C:\Users\User_account_name\AppData\Roaming\MetaQuotes\Terminal\Instance_id\MQL4\\experts. The items in bold are different on every computer.The easiest way to access this folder is by clicking File / Open Data Folder. Click MQL4, then experts.

    MetaTrader EA Location for build 600

    Make sure your EA is in the right place is by following this image’s instructions

  2. The changes to the MQL4 programming language broke your code. You need a MetaTrader programmer to modify your code so that it’s compatible with Build 600. The reason your EA or indicator doesn’t show up in MT4 is because the code no longer functions properly. That’s not your fault. It’s a direct result of the changes that MetaQuotes introduced into MQL4.

Why are they doing this?

The real reason is that MetaTrader 5 is a total failure from a business perspective. Only a handful of brokers have adopted MetaTrader 5 as an available platform. None that I know of boast about it. It’s an option that’s there, but nobody uses it. We’re all familiar and want to stick with MT4.

MetaQuotes’ response is to beat its users kicking and screaming where it wants to go. They want want everyone using MT5. Since the market has voted with its lack of adoption, MetaQuotes sees its best move as forcing MT5 into MT4. As they themselves describe it, they’re bringing the features of MT5 down to MT4.

That comes with a lot “challenges”. I say that facetiously because any tech company attempting a code roll out this severe is doomed to failure. They’ve tried to stuff 3 years of development work for a separate charting package into a release of older software. Not exactly a recipe for success.

We’re all familiar and want to stick with MT4.

MetaTrader 4 was never designed as a top end charting package. I’m from Texas, so I’m going to go with a gun analogy here to reinforce everyone’s stereotypes. MT4 is the AK-47 of charting packages. There are better, more sophisticated options available. But, an AK-47 still fires even if the chamber is full of dirt.

MetaTrader’s appeal is very similar. You don’t need years of trading experience to use it. You pretty much open it up and you’re all set.

The MQL4 language, at least as it was originally conceived, was equally basic. It was a scripting language. That’s fine if you want to build a moving average cross strategy. If you want to statistical analysis or implement complex logic, the simplicity adds a lot of overhead.

The introduction of object oriented programming to MQL4 attempts to support traders that want to follow a more sophisticated approach. The reason why object oriented programming is important is really beyond the scope of the article and, frankly speaking, most EA traders really could care less about the programming details. The takeaway is that you can do more complicated tasks in the new version of MQL4. It comes at the cost of breaking a lot of older EAs ad indicators.

Are you affected by the new changes to MQL4? Email info@onestepremoved.com with the .mq4 files that no longer function properly in order to receive a free estimate.

Filed Under: MetaTrader Tips

Can my broker steal my expert advisor?

October 17, 2013 by Shaun Overton 4 Comments

I get this question often enough that it’s time to put this out on the internet. There are plenty of reasons for traders to remain wary or suspicious of their broker. If you’re using the broker’s software, can they steal the expert advisors in your account that are making money?

Steal MT4 expert advisor

Can the broker steal your EA for MT4 or MT5?

The answer is an emphatic no. I started my career working as a broker and have been involved with forex for 7 years this month. I’ve seen the backend systems and tools that the MT4 brokers use to manage clients and their positions. I’ve also seen them on the floor of one of the MetaTrader bridge companies.

The brokers use a piece of software called the MetaTrader Manager. The manager is basically a database that tracks the open positions and equity for clients. It does not have a button for sucking MT4 expert advisors from client accounts.

Filed Under: MetaTrader Tips Tagged With: broker, expert advisor, metatrader, MetaTrader Manager, mt4

SPY Crisis Strategy Questions

October 14, 2013 by Shaun Overton Leave a Comment

Ed wrote me an email asking how he can trade the SPY Crisis Strategy. He likes the idea, but the problem is that his account balance is too small. He was under the impression that he can only participate with a futures account.

That was true several years ago. Luckily, the brokers have wised up and offer traders many more options. SPY is the ETF based on the S&P 500. ETFs are technically “Exchange Traded Funds”, but you can think of the SPY as a stock. You would place SPY trades in the same way that you buy or sell any stock in your brokerage account. Wikipedia offers a great ETF explanation if you’re new to the concept.

The returns that I posted for the strategy assumed that you were trading SPY without leveraged. If you’re a forex or futures trader, there are a few options available:

Forex traders can inquire if their broker offers index CFDs, especially if you want to trade the idea from MetaTrader. A CFD stands for “Contract For Delivery”, but don’t worry. Your broker has no desire or interest to make deliveries on oil or the S&P 500 CFDs. CFD is a legalistic creation where the broker promises to deliver the object traded on a certain date. In reality, the contract is perpetually rolled 2 days into the future. The position allows you to hold the spot price of the S&P 500 without needing to purchasing any stocks or resorting to the futures market.

The best option for futures traders are the e-minis (Symbol: ES). You should trade the front month contract for all signals. This is certainly the most efficient way to trade the idea. The only reason I stuck with the ETF is that I don’t have to dive into messy backtesting assumptions with continuous contracts and rolling open positions.

NinjaTrader is a great option regardless of the instrument that you trade. It’ll handle any market that you select: CFD, futures or the ETF.

Filed Under: MetaTrader Tips, Trading strategy ideas Tagged With: CFD, continuous contract, e-mini, etf, forex, futures, S&P 500, SPY, stock

Comparison: MetaTrader, NinjaTrader, TradeStation

July 19, 2013 by Shaun Overton 15 Comments

Pros and Cons of MetaTrader, NinjaTrader and Trade Station

NinjaTrader, MetaTrader and TradeStation are by far the most popular platforms among the retail trading crowd. Each one tends to focus on a special market niche. MetaTrader primarily caters to forex market. NinjaTrader’s fan base mainly comes from futures. TradeStation earns most of its business from equities traders.

Despite their popularity among certain markets, each platform is fully capable of handling the different types of markets. It all comes down to which platform suits your needs. They all offer automated trading as well as backtesting capabilities. If popularity plays a role in your decision making, then you may want to review Google Trends.

Advantages of MetaTrader

Disadvantages of MetaTrader

  • Literally hundreds of different brokers offer the platform
  • Large number of commercial products (indicators and Expert Advisors) are available for sale
  • It’s 100% free
  • Everything is setup once you download the platform
  • No reliable data source for backtesting
  • Allows repainting indicators
  • Slow execution, not suitable for running multiple high frequency strategies
  • MQL restricts you to only trade related programming. Anything else requires DLL programming
  • Can’t keep record of bid and ask in the backtester.
  • No custom time frames on charts
  • MQL itself has a lot of unusual bugs

Advantages of NinjaTrader

Disadvantages of NinjaTrader

  • Free to use in demo mode, affordable live mode
  • Very scalper friendly with ATM feature
  • Multiple brokerage offerings
  • C# programming offers extreme flexibility
  • Supports multiple charting types
  • Great technical support on their forums
  • Lots of third party add ons are available
  • Ability to securely sell strategies using the native software
  • The learning curve is fairly steep to get started. The datafeed is not included.
  • Programming usually takes longer than in other platform
  • The number of supported brokerages is far lower when compared to MetaTrader
  • Strategies that are very concerned with position sizing require a lot of extra programming to simulate in the backtester
  • Approval is centralized for all third party products

Advantages of Trade Station

Disadvantages of Trade Station

  • Great technical support on their forums
  • Simple strategies are very simply to program
  • Lots of third party add ons are available
  • It’s much more expensive compared with its competitors
  • Can only trade with Trade Station as your broker
  • No demo mode offered
  • Approval is centralized for all third party products

If you would like to develop an indicator or strategy for any of these platforms, we offer conversion services between charting packages.

Filed Under: MetaTrader Tips, NinjaTrader Tips

Using Expert Advisors For Automated Trade Management

May 2, 2013 by Edward Lomax 4 Comments

Over the past couple weeks, I’ve been going over how manual traders can use expert advisors to simplify and improve their trading. Expert Advisors are not just for automating your trading strategy. Expert Advisors can be used before the trade, when placing the trade and/or after the trade.

Today, I want to talk about my favorite topic…

Using Expert Advisors For Automated Trade Management

I’m sure this has happened to you…

Before the trade is placed many traders are completely rational beings. They have a trading system they use and understand the conditions necessary for entering the trade. (They also should understand the importance of money management and have a professional formula for determining the risk of each trade). However, once the trade is placed and real money is on the line… they become completely irrational.

Every trading system should have a reason to get into the trade, and a reason to get out of the trade. Trade management is very important to your success, and is probably more important than the entry criteria. But it is very hard to stick to the trade management rules when in a live trade risking real money.

Here are a couple things that happen…

  • The trade starts to go against you so you decide to close the trade early so your stop won’t get hit.
  • The trade starts to go in your favor so you decide to close the trade early so you don’t lose the profits you’ve already gained.

Regardless of the outcome… this is the wrong way to trade.

In both cases, you are not sticking to your rational trading plan. You are being irrational and making decisions based on emotions. And yes, sometimes you are rewarded for your bad behavior and you make the profitable choice. But in my opinion, you are still wrong because you broke your trading plan.

This problem can be fixed by automating your exit strategy with an EA programmed to manage the trade after it is placed. Once the trade is placed manually, the EA takes over and manages the trade perfectly according to the rules every time.

Ideas For Using A Trade Management EA

I want to give an example so you know what I’m talking about. Here are my favorite things to do with an trade management EA:

Trail Your Stop Loss: There are 3 ways I trail my stop…

  • To reduce risk: If the trade starts going in my favor, there is a point where I want to reduce the risk by tightening the stop. For example, moving the stop from 100 pips to 50 pips. This reduces the risk I have on the trade if price goes against me.
  • To eliminate risk: At some point in the trade I want to eliminate risk all together. This happens by moving the stop to Breakeven or a little higher. This now takes the stress out of the trade since I no longer can lose any money.
  • To lock in profits: There are levels in the trade where I would not want to see all my profits eaten up if the market reverses. At these levels, I like to lock in some profits my having the stop moved up. Worse case at this point is I make some money in the trade.

Take Partial Profits: At some point in the trade you might want to put some money in your pocket. You can do this by taking off a portion of your position. Then you let the rest of the position run to a higher take profit level. Here is a photo showing a trade where partial profits were taken…

A partial take profit exits from a trade.

A partial take profit exits from a trade.

Benefits Of Using Expert Advisors For Trade Management

I want to go over why I think automating your trade management is so important. I personally use a trade management EA and credit a lot of my success to being able to automate my exit strategy. Hey, I’m only human… and the emotions of trading can get to me too.

Using Trade Management EA’s Frees Up Your Time (Less Stress): Trading is time consuming. First, you have to sit and wait for the right trade setup, which can be boring. Second, you have to manage the trade, which can be stressful. If you use a set-and-forget type trading system so you can step away from the computer once the trade is placed, you might be missing the opportunity to protect the trade by moving the stop or taking partial profits.

A better option is to program a trade management EA to trade your exit strategy. Then walk away from the computer knowing the expert advisor will take the correct action even though you are not there.

Using Trade Management EA’s Keeps You From Missing Opportunities (More Accurate): Even if you want to manage the trade on your own by moving the stop loss or taking partial profits, if you step away from the computer you might miss the opportunity. You go to the kitchen to get an apple… and when you come back price hit the level to move your stop, but now price reversed. (Missed opportunity).

Worse yet… having to take the actions yourselves might mean you change your mind. Price hits a level where you need to take action… but you decide to wait in the hopes of making more money. You are now not trading your system accurately.

Using Trade Management EA’s Keeps You On Your Trading Plan (Potentially More Profitable): You have a trade plan for a reason. When you are rational you figure out the best trade rules. So, the best thing to do is set up a trade management EA to trade according to those rules.

The beauty of using a EA to manage the trade after it is placed is you trade according to your rules EVERY time. There is no decisions being made on emotions so you are a “better” trader because you stick to the rules. This can also mean you are more profitable over time.

I think managing a trade under live market conditions when real money is on the line is the hardest part of trading. This is why it is best to automated your exit strategy and let an expert advisor do it for you. If you’ve taken one thing away from this series, I hope you see the importance of using expert advisors as manual traders can have on your results.

Next time I want to go over the 5 characteristics of a good trading strategy. See you then.

Filed Under: MetaTrader Tips

  • 1
  • 2
  • 3
  • …
  • 7
  • Next Page »
FREE trading strategies by email

Trending

Sorry. No data so far.

Archives

  • Dominari
  • How does the forex market work?
  • Indicators
  • MetaTrader Tips
  • MQL (for nerds)
  • NinjaTrader Tips
  • Pilum
  • QB Pro
  • Stop losing money
  • Test your concepts historically
  • Trading strategy ideas
  • Uncategorized
  • What's happening in the current markets?

Translation


Free Trading Strategies

Privacy PolicyRisk Disclosure

Copyright © 2023 OneStepRemoved.com, Inc. All Rights Reserved.