Algorithmic and Mechanical Forex Strategies | OneStepRemoved

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

Trading with the Commodity Channel Index

September 14, 2016 by Lior Alkalay 4 Comments

When trading, one of the most important pieces of information to have is the ability to identify momentum—when it begins and when it ends. It can help you plan your next trade and to ensure that that trade is successful. It is in the process of charting momentum that the Commodity Channel Index is especially effective, and that is regardless whether you are trading commodities, stocks or Forex.

The rationale behind the Commodity Channel Index or CCI is that it is an oscillator that measures the deviation from the simple moving average over the period. Just like most oscillators, it has an overbought level and an oversold.

In theory, using the CCI is similar to reading a Relative Strength Indicator (RSI). If the CCI is relatively high then the pair is overbought and when it is relatively low, the pair is oversold. In practice, however, using the CCI is a bit more complicated than the RSI. Unless the CCI is calibrated correctly it is practically worthless in identifying momentum cycles. Moreover, without correct calibration, it can generate plenty of false signals. But if you calibrated the CCI well it is an extremely efficient and powerful tool.

Commodity Channel Index: Calibration

The first step in calibrating the CCI is to identify when the current cycle began. This will help us decide the right period in which to run the CCI. In order to identify the beginning of the current cycle we can use Fibonacci Time Zones, which will give us an accurate measure.

For example, when we look at the Fibonacci Time Zones in the weekly chart below, we can conclude that the current cycle started 36 weeks ago. The rule of thumb is to divide the total period by three to give the average a bit more sensitivity. In the example below, it will be 36/3=12 weeks. That is the average the CCI should run on.

The reason we use Fibonacci Time Zones to calibrate the CCI is because the cycle’s length changes from wave to wave as they become longer and consequently the relevant average changes. Through the Fibonacci Time Zones, we can estimate with some degree of confidence when the cycle started.

Commodity Channel Index

Analysing the CCI

Once the CCI is calibrated, the rest is simple. The CCI, as previously mentioned, measures overbought and oversold levels. But rather than just looking at relative highs of the index we need to look at its behavior.

For example, in the Gold chart below, we can see that the CCI is converging with the price movement. That is a clear sign that bullish momentum is fading. If we take it a step further and continue our trend line all the way to the bottom, we can conclude another thing; that is that the pair, in this case XAU/USD, has already peaked and is heading lower in a bearish momentum.

Commodity Channel Index

Another way to chart the momentum is by examining the CCI behavior between the Fibonacci Time Zones. Notice that the CCI has a tendency to bottom out when the cycle ends and then rise. We can use that to ride on a rebound. There are cases, especially on a long term bullish trend, that we can get the exact opposite effect, i.e., the CCI peaks every time a Fibonacci Time Zone ends. The idea is to observe the pattern and then use it to your advantage.

Of course, as I’ve said in the past, oscillators should always be used alongside other indicators to get the full picture, and the Commodity Price Channel is no different. As usual in trading, there are no guarantees, but certainly the well calibrated CCI can provide a very coherent picture of where a pair’s momentum is headed, north or south.

Filed Under: Trading strategy ideas Tagged With: CCI, Fibonacci, gold, indicator

What’s the Story on Lagging Indicators?

January 14, 2015 by Richard Krivo 7 Comments

Lagging Indicator

A  question that I get asked quite a bit has to do with “lagging indicators”.  Many traders will deride them and are hesitant to use them since they lag the market to a greater or lesser degree.  Their argument is that many pips can be left behind since the initial part of the move has occurred before the entry signal is generated.

While that is an accurate statement, let’s take a look at what comprises the signal that an indicator generates.  Regardless of which indicator a trader uses, RSI, MACD, Stochastics, CCI, etc., each indicator is based on an average of the price action that has already taken place.  With that being the case, it is impossible for an indicator to provide split second, turn on a dime signals based on an immediate move that a currency pair has made.

And, believe it or not, I believe that is a very good thing.

While no one likes to leave “pips on the table” so to speak, think of it this way…

What you are forgoing by missing the initial move, you make up for by entering a trade that has a greater amount of confirmation behind it.  If we are looking to enter a trade at the very first sign that a move may be taking place, we are going to find ourselves entering trades based on very short term signals – i.e., little or no confirmation.  Consequently, we will be basing our trades on what ultimately can turn out to be a “false entry” signal.

People will rarely (if ever) buy a house based solely on what it looks like from the curb…or buy a car only because the driver’s seat feels comfortable…or propose marriage to someone during a first date.  We want and deserve some confirmation that there is more to the house than only curb appeal…more to the car than just a comfy seat…and more to our partner than what we learned over a few hours.

So too, we should not jump headlong into a trade based on virtually zero confirmation.

Let’s take a look at a historical Daily chart of the EURCHF currency pair below…

Lagging Chart

If we enter this trade at the point where the MACD line (red) crosses the Signal line (blue), we forgo the profit between point A and point B on the chart – approximately 280 pips.  This is due to the “lag” of the MACD indicator as it is calculating the price action that has taken place over the last several days.  Had we entered the trade short as soon as price began to move down from the high, we would have entered on a bearish move but with virtually no confirmation – we would have bought the house without stepping inside.

However, if we wait for the signal to enter this trade until the move is confirmed by MACD, we set ourselves up for a higher probability trade based on our lagging indicator.

Could this trade turned out to be a loser even with the confirming signal?  Sure…no doubt about it.  But the point is that by waiting we are putting probabilities more on our side – we have more of an “edge” on the trade.

In the case of this particular trade, we ultimately book the profit between point B and point C which is just shy of 1000 pips.

As can be seen from this example, it is possible to have a highly successful trade even though a trader is not capturing the initial pips in a move.

All things considered, I would rather enter a trade late and be right than enter early and be wrong.

 

All the best and good trading,

Richard

 

RKrivoFX@gmail.com

@RKrivoFX

Filed Under: Trading strategy ideas Tagged With: CCI, indicator, lagging, MACD, RSI, Stochastics

What Is the “Best” Indicator for a Trader to Use?

November 27, 2014 by Richard Krivo 11 Comments

A major concern of newer traders is which is the best indicator for them to use in their trading.  Also, they want to know if indicators can be broken down into beginning, intermediate and advanced trading categories.

best-choice-label

Personally, I don’t think of indicators as being in categories or this one is the best and that one is the worst.  Rather, I would suggest that you familiarize yourself with all of the major indicators and then settle on the one or two that you find make the most sense to you.  Someone else’s “ideal” indicator may not appeal to you at all and that is fine.  Use the one(s) that you understand, feel comfortable using and assists you in putting pips in your account on a regular basis.  After all, pip accumulation is the final arbiter when it comes to evaluating the success of one’s trading.

When going through your indicator evaluation process, I recommend that you put only one indicator at a time on your chart.

This will make the chart less cluttered and bring more clarity as you compare one indicator to another.  Moreover, it will be easier for you to evaluate the indicators individually as opposed to attempting to evaluate them en masse.  When you finally decide on the one or two  (keep your chart uncluttered) and begin using them as part of your trade analysis, remember to consult the price chart first and the indicator second.

Price is indicator #1

We want to focus on taking trades in the direction of the Daily trend.  The trend is the deciding factor in whether or not we will be buying or selling the pair.  Then, after that decision has been made, we check the indicator.  We are looking to see when the indicator will provide us with an entry signal that is in the direction of the longer term trend.  Don’t simply focus on the indicator to determine whether you buy or sell the pair.  If you do that you will find that you will be entering trades that have a lower probability of success – those that are against the trend – and you will be chasing the market.

Remember:  the indicator does not know the direction of the trend but the price chart does.

The price chart is where your analysis should begin.  For the record, my personal indicators of choice are the 200 SMA, Donchian Channels and Slow Stochastics.

All the best and good trading,

Richard Krivo

RKrivoFX@gmail.com

@RKrivoFX

Filed Under: Trading strategy ideas, What's happening in the current markets? Tagged With: indicator

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

Cumulant Ratio Indicator

October 17, 2013 by Shaun Overton 2 Comments

Coursera is one of my favorite sites online. Two weeks ago, I finally had the opportunity to register for the course that I’ve been waiting for: Digital Signal Processing.

Digital Signal Processing is used in everything from music to communications to… predicting financial markets. Although it’s not the focus of the class, I already drummed up a few ideas worth exploring as indicators.

The first indicator idea that the course inspired, and the one that I’m the most excited about, looks for bars that are out of place with their peers. I arbitrarily chose a lookback period of 20 for my analysis.

Steps to calculate the cumulant ratio:

  1. Calculate the average for periods 1-20
  2. Calculate the sum of the absolute value of Close of the bar – average for bars 1-20
  3. Calculate the sum of the Close of bar 0 (the last closed bar) – close of each bar, 1-20
  4. Divide step 3 by step 2

The initial result looked as expected. I placed the absolute value bars on step 2 so that I wouldn’t have to worry about the average changing the sign of the output. The top function is only positive if the current price is “above” the sum of the last 20 bars. A negative position means that the current price is “below”.

cumulant ratio indicator

Most markets are noise, which creates a natural noise band between ±1. Prices way out of line with the average show huge jumps like the one in the image.

Values around ±1 are expected. You wouldn’t, after all, expect a new bar to throw off the calculations very much.

That’s exactly the point. If something is near the ±1 window, then it’s probably worth ignoring. The price action is pure chop.

The real value is in the spikes. A spike of 20 isn’t any more important than a spike to 50. Above a certain threshold, the trader just needs to pay attention. It’s a black and white issue.

Strategy Ideas

My initial instinct was that the indicator would work well on emerging market currencies like TRY and ZAR. They’re so breakout prone that entering on the right side of the move, regardless of the reason, should do well.

It took about 20 minutes of chart gazing to come up with the strategy for the H4 chart. It was flat on most currencies, but USDZAR stood out. This equity curve used my initial settings without optimization. More importantly, the profit factor improved on a 1.5 year walk forward test.

Cumulant Ratio Strategy USDZAR

The breakout strategy did great on USDZAR H4 charts

The majors showed exactly the opposite. They do trend, but hardly in the mega-monster manner of the emerging markets. I modified the strategy to do the opposite and let ranging conditions prevail. EURUSD, as seems to be usual with range trading strategies, stood out as the best performer.

Cumulant Ratio EURUSD

The range trading approach works best on EURUSD H4

Nerd section

For the math nerds and programmers out there, the formula for the indicator is below.

cumulant ratio equation

The equation for the cumulant ratio

Filed Under: Trading strategy ideas Tagged With: Coursera, cumulative ratio, digital signal processing, emerging markets, eurusd, indicator, TRY, USDZAR, ZAR

Too Many Charts

July 5, 2012 by Shaun Overton 2 Comments

A million charts on the screen. It looks like a blob of every known currency pair with a mix of every time frame added for good measure. You, my friend, suffer a nightmare juggling the EA settings on all these charts.

The idea of running a single Expert Advisor that trades all charts and multiple time frames stands out as an obvious solution. It’s not a good one, though. The way that MetaTrader 4 is designed prevents this setup from working smoothly.

The start() function in MQL4

MQL4 Expert Advisors only run in one of three different ways. The init() function is called when you load the EA onto a chart. The deinit() function operates whenever you remove the EA. That leaves the start() function. It’s like the beating heart of all MQL4 programs.

Incoming ticks tell the chart to notify an attached expert advisor about the updated price. When that occurs, the expert advisor runs the start() function. That function contains all of the code that traders associate with expert advisors: placing trades, implementing trailing stops, etc. All of those actions depend on incoming ticks.

The organization of MQL4 creates a problem for the goal of creating an EA that places trades for all charts. Expert advisors only update when a tick comes in. If I wanted to trade the GBP/JPY from a chart attached to the EUR/USD, any delay in EUR/USD ticks causes a delay in executing GBP/JPY trades.

This probably does not seem like a big deal. It isn’t a big deal – most of the time. It can, however, create a nagging problem of wondering why a noticeable percentage of trades seem to execute late. Traders on one minute charts would even notice missed signals. Although it’s not frequent, even the major pairs often go longer than one minute in between ticks.

Work-arounds

One idea to reduce the number of open charts while ignoring the incoming tick problem is to create an EA that trades on multiple time frames for the currency pair where it’s attached.  If I wanted to trade the AUDCAD on M30, H1, H4 and D1 charts, then I could place the EA on one of the those charts but have it look for trades on the selected time frames. This type of solution could decrease the number of open charts by 75% or more.

The idea of controlling everything from a single chart is very similar to the market scanning indicator that we created several months ago. There is really no difference between that indicator and the expert advisor proposed here. I feel that missing an indicator signal is of far less consequence than missing trade signals. Expert advisors are more likely to perform extra, ongoing operations like trailing stops that indicators completely ignore. The consequence of delayed ticks is far less significant for an indicator than it is for an EA.

Filed Under: MetaTrader Tips Tagged With: EA, expert advisor, indicator, metatrader, mql, multiple time frame, scanner, start

MQL Organization

May 1, 2012 by Shaun Overton Leave a Comment

All MQL expert advisors and indicators contain a few essential components. The general organization of MQL programs does not vary too often.

Files usually start with a declaration of #defines (pronounced pound define) global variables and external variables, also known as an extern data type. They appear near the top of the code to help the read gain an understanding of the variables that will run in the program. Ideally, the names of the variables and how they are organized should assist the programmer with form a general understanding of what the expert advisor or indicator might do.

The next section is usually the init() function, which is the word initialize abbreviated. This section of the code is particularly relevant to programming custom indicators. Most of the general indicator settings like declaring the indicator buffers, the colors to use and other basic features are set within this section. I use init() in every expert advisor that we build to convert the inputs into an appropriate setting for the broker’s pricing. If a client inputs a stop loss of 50 into an EA, I don’t need to do anything if it’s a 4 digit broker. I do, however, need to convert the input to work with a 5 digit broker. I run a quick check within init() to see if Digits == 3 || Digits == 5. If so, then I multiply inputs affected by that setting by 10.

deinit() is the least important section; it’s pretty easy to deinitialize an MQL file because it usually does not take up any system resources. It’s rarely used for anything important. The only uses that I ever have for deinit() are to close an open file handle or to make some sort of closing note. This is often done either on the chart directly through the Comment() function or more often by writing directly into the log file.

The start() function is the real meat of an MQL expert advisor or indicator. Whenever MetaTrader detects an incoming tick, it alerts any MQL programs. Those programs then call the start function so that it can do whatever needs doing. All trading operations, calculations, account monitoring, etc, occur within this section.

All of the other custom functions within the program appear below start(). I usually prefer to rank them in order of their importance or the frequency with which I call them throughout the program. The order of placement of functions does not affect performance in any way at all. It’s strictly a cosmetic practice that makes programming code more legible.

Filed Under: MQL (for nerds) Tagged With: deinit, expert advisor, indicator, init, mql, MQL4, start

Install MetaTrader Indicator

January 11, 2012 by Shaun Overton 9 Comments

Custom indicators are one of the more popular items to share on sites like Forex TSD and FX Fisherman. If you’re new to MetaTrader 4 and need help installing indicators, this page will walk you through it step by step. You might also consider watching the YouTube video.

You first need to download the indicator as an .mq4 or .ex4 file to your computer. .mq4 simply means that the person sharing the file chose to give you access to the original code. An .ex4 file means that you cannot access the contents. Rest assured that either file type will work properly in MetaTrader.

The most common issue that the “computer literacy challenged” face is that they can’t remember where they downloaded the file. If you fall into this category, I recommend that you download the file to your desktop. That way, you don’t have to worry about losing it.

The only critical step in this process is to make sure that your custom indicator eventually makes it to the correct folder. The correct folder will vary slightly based on your operating system and broker.

If you use MB Trading and your computer uses Windows XP, then the correct location to put your indicator is:
C:\Program Files\MBT MetaTrader 4\experts\indicators\

If you use Alpari with Windows Vista or Windows 7, then the correct location would be:
C:\Program Files (x86)\MetaTrader – Alpari UK\experts\indicators\

You’ll notice that after the first “\” slash, it’s always “Program Files” or “Program Files (x86)”. This is the only part that changes with the operating system that you use. The broker, which comes after the second “\”, does not follow any convention. A lot of brokers place the word MetaTrader in front of the broker name. Not all brokers do this, however. You’ll have to search through each available folder to find the right one for your broker.

If you have MT4 open, then you need to close it before you can use the indicator. Once you reopen MetaTrader 4, you’ll see the file located in “Custom Indicators” in the Navigator.

Custom indicator in MetaTrader Navigator

A custom indicator called #StochArrows in the MetaTrader Navigator. Click the + icon next to Custom Indicators

Email a custom MetaTrader indicator

Emailing a custom MetaTrader indicator is essentially the installation process in reverse. Write an email message like you would to anyone else, then click the attachment button. A new window will pop up and ask you where to find the file. You’ll need to navigate to the same folder directory that I described above.

Send indicator as an attachment

Find the installation folder for your custom indicator and send it as an attachment.

Push “attach” or “open”.  Write out your email message, then push send. Your MetaTrader custom indicator is on its way to your trading friends.

Filed Under: MetaTrader Tips Tagged With: custom indicator, indicator, metatrader, Navigator, windows 7, windows vista, Windows XP

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 © 2022 OneStepRemoved.com, Inc. All Rights Reserved.