Profit from ranging and trending conditions!
“The CMI is a simple indicator that gauges whether the market has behaved in a choppy (non-directional) manner or a trending (directional) manner. The indicator calculates the difference between the most recent bar’s close and the close n bars ago and then divides this value by the difference between the highest high and lowest low over these n bars.”- DANIEL FERNANDEZ (Currency Trader Magazine, August 2011 issue – page 20)
The CMI indicator enables an easy way to build a daily strategy that can profit from both ranging and trending conditions by incorporating 2 entry rules. The first will tackle the range, while the second will handle the trending market. Both entries will have exit positions when the CMI crosses the 50 percent level, which suggests uncertainty about whether the market is ranging or trending.
- Range strategy rules
1. Enter long when the smoothing MA (blue line) of the CMI is below 40 and the CMI line color is red.
2. Enter short when the smoothing MA (blue line) of the CMI is below 40 and the CMI line color is green.
3. Exit trades trades when CMI moves above 50.
- Trend strategy rules
1. Enter long when the smoothing MA (blue line) is above 60 and the CMI line color is green.
2. Enter short when the smoothing MA (blue line) is above 60 and the CMI line color is red.
3. Exit trades when CMI moves below 50.
“Tackling trending and ranging markets with CMI” article by DANIEL FERNANDEZ in the August 2011 issue of Currency Trader
Accessing the values for use in an EA
CMI indicator values can be accessed from an EA or Script in Metatrader using MQL iCustom() function calls for individual values. For example, to access the value of the smoothing MA for the latest completed candle, you need to call iCustom with the following parameters:
iCustom(NULL, 0, "Market//choppy-market-index-indicator", 60, 10, false, 3, 1);
The CMI line can be accessed in 3 different ways. To get the CMI line value for the latest completed candle, you need to check index 0:
iCustom(NULL, 0, "Market//choppy-market-index-indicator", 60, 10, false, 0, 1);
The CMI value for green and red colors is accessed via index 1 and 2:
iCustom(NULL, 0, "Market//choppy-market-index-indicator", 60, 10, false, 1, 1); // green line iCustom(NULL, 0, "Market//choppy-market-index-indicator", 60, 10, false, 2, 1); // red line
The example iCustom() calls presented above use default indicator settings 60, 10 (period / MA period).
Investments in commodity contracts such as Forex involve a high degree of risk to your money. Before investing in such markets you should be well aware of the risks involved due to the fluctuation in the value of such commodities’ prices, which can cause fluctuations in the value of your investment. You should therefore not invest in this market if you do not have adequate experience. You are also advised not to invest funds that you can not afford to lose.
The author of this page and its contents is not responsible for any loses, misunderstandings, omissions or missing information of any kind. All investors are advised to build their understanding of the Forex market from various sources before making any investment decisions. This is neither a solicitation nor an offer to Buy/Sell currencies, futures, stocks or options on the same. No representation is being made that any account will or is likely to achieve profits or losses similar to those written on www.the-forex-strategy.com and/or www.az-invest.eu.
The past performance of any trading system or methodology is not necessarily indicative of future results. No guarantee is made that you will be able to replicate the same results.