Русский 中文 Español Deutsch 日本語 Português
Trading with Donchian Channels

Trading with Donchian Channels

MetaTrader 5Tester | 2 June 2017, 16:49
26 376 8
Alexander Fedosov
Alexander Fedosov

Contents

Introduction

The Donchian Channel is a technical indicator developed in early 1970s. First it was called a Moving Channel, and later was renamed after its creator Richard Donchian. This indicator measures the degree of market volatility based on a given price range using recent lows and highs. The Donchian channel is drawn as two lines, between which the price fluctuates. Sell or buy signals are formed when the price breaks the lower or upper channel border respectively. The author recommended to draw the channel using the price range equal to 20 (an average number of business days in a month) and the D1 timeframe.


Operation Principle and Application of the Donchian Channel

I will not reinvent the wheel and will not create another program implementation of this indicator. I decided to use its Donchian Channels System modification, which perfectly characterizes the trading style based on this system. In Fig.1 pink and blue candlesticks show the areas where the channel borders are broken, market entry is supposed in this places.


Fig1. Operating principles and entry points based on the Donchian Channel.

Pay attention to red areas marked on the chart. They indicate the main disadvantage of the Donchian channel — the so-called false breakouts, after which the price rolls back into its range. Therefore, entering the market by only using the Donchian Channel without additional confirmation would be reckless. In order to have a clearer understanding of the indicator idea, let us analyze the parameters and implementation of this modification:

//+----------------------------------------------+
//|  Indicator input parameters                  |
//+----------------------------------------------+
input uint           DonchianPeriod=20;            // Averaging period
input Applied_Extrem Extremes=HIGH_LOW;            // Type of extrema
input uint           Shift=2;                      // Horizontal shift in bars
//+----------------------------------------------+

  • Averaging period is the used price range.
  • Type of extrema means the type of price values used in calculations. A classical setup is used by default, which means using candlestick high and low values.
  • Horizontal shift in bar means shifting the channel.

Let us dwell on extrema types, because in this modification not only High and Low can be used. Below are possible options and software implementation:

//+----------------------------------------------+
//|  Declaration of enumeration                  |
//+----------------------------------------------+
enum Applied_Extrem //Type of extrema
  {
   HIGH_LOW,
   HIGH_LOW_OPEN,
   HIGH_LOW_CLOSE,
   OPEN_HIGH_LOW,
   CLOSE_HIGH_LOW
  };

  • HIGH_LOW is the classical application of candlestick Highs and Lows.
  • HIGH_LOW_OPEN — in this interpretation, the upper channel border is drawn based on the average value between the open price and the candlestick highs in the selected price range. Candlestick lows are used for the lower border.
  • HIGH_LOW_CLOSE — the upper channel border is drawn based on the average value between the close price and the candlestick highs in the selected price range. Candlestick lows are used for the lower border.
  • OPEN_HIGH_LOW — the upper border is drawn based on the highest open prices over the selected price range, and lowest ones are used for the lower border.
  • CLOSE_HIGH_LOW — the upper border is drawn based on the highest close prices over the selected price range, and lowest ones are used for the lower border.

The listing of implementations of different type of extreme values is available below:

for(bar=first; bar<rates_total && !IsStopped(); bar++)
     {
      switch(Extremes)
        {
         case HIGH_LOW:
            SsMax=high[ArrayMaximum(high,bar,DonchianPeriod)];
            SsMin=low[ArrayMinimum(low,bar,DonchianPeriod)];
            break;

         case HIGH_LOW_OPEN:
            SsMax=(open[ArrayMaximum(open,bar,DonchianPeriod)]+high[ArrayMaximum(high,bar,DonchianPeriod)])/2;
            SsMin=(open[ArrayMinimum(open,bar,DonchianPeriod)]+low[ArrayMinimum(low,bar,DonchianPeriod)])/2;
            break;

         case HIGH_LOW_CLOSE:
            SsMax=(close[ArrayMaximum(close,bar,DonchianPeriod)]+high[ArrayMaximum(high,bar,DonchianPeriod)])/2;
            SsMin=(close[ArrayMinimum(close,bar,DonchianPeriod)]+low[ArrayMinimum(low,bar,DonchianPeriod)])/2;
            break;

         case OPEN_HIGH_LOW:
            SsMax=open[ArrayMaximum(open,bar,DonchianPeriod)];
            SsMin=open[ArrayMinimum(open,bar,DonchianPeriod)];
            break;

         case CLOSE_HIGH_LOW:
            SsMax=close[ArrayMaximum(close,bar,DonchianPeriod)];
            SsMin=close[ArrayMinimum(close,bar,DonchianPeriod)];
            break;
        }


Developing a Trading System

When developing a strategy, we need to take into account not only false breakouts, but also the fact that the Donchian channel is most often used in trend strategies. The entry signal is formed by the channel breakout, therefore, in order to eliminate false exits outside channel borders, we need to use at least one trend indicator for signal confirmation. We also need to determine exact conditions for entry, open position management, exit, and money management. Let us formulate the above conditions.

1. A confirmation signal

The purpose of the article is not only to show examples of trading based on Donchian channels, but also to analyze them in terms of "survivability" in modern markets. Therefore, let us select a few confirmation indicators. Each of these indicators will form a tandem with the Donchian Channel. Thus we obtain several trading strategies based on the analyzed underlying strategy. To create tandems, I selected three confirmation signals from the following indicators:

  • Average Directional Movement Index (ADX). A combination with this signal will allow us to evaluate the state and strength of the current trend, and then enter into the market upon the breakout of the channel borders.
  • Moving Average Convergence/Divergence (MACD). MACD will monitor the current trend. When the price breaks the channel borders, we will check if this breakout is in the market direction or it is an accidental price spike (a false breakout).
  • The third confirmation will be generated by two indicators: Average Speed (the average price change speed in points/min) and X4Period_RSI_Arrows (a semaphore indicator consisting of four RSIs with different periods).

2. Formalizing trading systems

We need to find common parameters for these three strategies: let us select them so as to provide the maximum possible testing period. Therefore, let us define the parameters that will be controlled during testing:

  • Timeframe. The timeframe selection option will allow us to test the strategies on different time periods, which can characterize specific market phases, including weak movement and correction, as well as long trends, which may be obvious on higher periods.
  • Money Management. Several position sizing options depending on trade results will allow us to reveal whether re-investing is efficient or if it is more convenient to trade a fixed lot.
  • Open Position Management. Several options of managing an open position will help us determine the profit as the percentage of the current favorable movement that we can fix.
  • Indicator Parameters. Testing of selected strategies in different modes will help us find optimal parameters, with which our system will be efficient, as well as detect parameters that can make our system unprofitable.

Next, we need to formulate entry conditions for our trading strategies:

#1. Donchian Channel + ADX.

Conditions for the system:

  • The price breaks the upper or lower border of the Donchian channel.
  • The main line of the ADX trend strength must be above the pre-set ADX Level.
  • If the price breaks the channel border upwards, the DI+ line must be above DI-. DI- must be above DI+, if downwards.

Fig.2. Market entry conditions of the strategy Donchian channel+ADX

#2. Donchian Channel + MACD.  

Conditions for the system:

  • The price breaks the upper or lower border of the Donchian channel.
  • Also, the histogram value is above zero and above the signal line for buying.
  • The histogram value is below zero and below the signal line for selling.

Fig.3. Market entry conditions of the strategy Donchian channel+MACD

#3. Donchian Channel + (Average Speed and X4Period_RSI_Arrows).

Here are the system conditions:

  • The price breaks the upper or lower border of the Donchian channel.
  • The value of Average Speed must be greater than 1, and the semaphore RSI must mark at least 2 points above the candlestick for selling or below the candlestick for buying.

Fig.4. Market entry conditions of the strategy Donchian channel+(Average Speed and X4Period_RSI_Arrows)

Implementing a Trading Strategy

For the convenience of testing and optimization, all this types of strategies will be implemented in one Expert Advisor. The EA parameters will provide a selection of four strategies:

//+------------------------------------------------------------------+
//|  Declaration of enumerations of strategy types                   |
//+------------------------------------------------------------------+
enum Strategy
  {
   Donchian=0,
   Donchian_ADX,
   Donchian_MACD,
   Donchian_AvrSpeed_RSI
  };

  • Donchian — a breakout strategy only using the Donchian channel.
  • Donchian_ADX — a strategy with the ADX trend strength indicator used as a filter.
  • Donchian_MACD — a strategy with the MACD oscillator used as a filter.
  • Donchian_AvrSpeed_RSI — a strategy with the price rate of change and the semaphore RSI with different periods used as the filter.

Then we declare types of extreme values used for the Donchian channel, which we want to test:

//+------------------------------------------------------------------+
//| Declaration of enumerations of extreme types                     |
//+------------------------------------------------------------------+
enum Applied_Extrem
  {
   HIGH_LOW,
   HIGH_LOW_OPEN,
   HIGH_LOW_CLOSE,
   OPEN_HIGH_LOW,
   CLOSE_HIGH_LOW
  };

In addition, the Expert Advisor will provide for the possibility to use three money management systems:

//+------------------------------------------------------------------+
//|  Enumeration for lot calculation types                           |
//+------------------------------------------------------------------+
enum MarginMode
  {
   FREEMARGIN=0,     //MM Free Margin
   BALANCE,          //MM Balance
   LOT               //Constant Lot
  };

  • FREEMARGIN — calculating the basic lot based on the free margin.
  • BALANCE — lot calculation based on the current balance.
  • LOT — fixed lot. It is a manually specified basic lot.

Open positions will be managed by a system based on the Universal Trailing Stop Expert Advisor. On its basis, the CTrailing class was developed, which is located in the Trailing.mqh file.

Position managing methods and input parameters are given below:

enum   TrallMethod
  {
   b=1,     //Based on candlestick extrema
   c=2,     //Using fractals
   d=3,     //Based on the ATR indicator
   e=4,     //Based on the Parabolic indicator
   f=5,     //Based on the MA indicator
   g=6,     //% of profit
   i=7,     //Using points
  };


//--- Trailing Stop parameters

input bool                 UseTrailing=true;                            //Use of trailing stop
input bool                 VirtualTrailingStop=false;                   //Virtual trailing stop
input TrallMethod          parameters_trailing=7;                       //Trailing method

input ENUM_TIMEFRAMES      TF_Tralling=PERIOD_CURRENT;                  //Indicator timeframe

input int                  StepTrall=50;                                //Trailing step (in points)
input int                  StartTrall=100;                              //Minimum trailing profit (in points)

input int                  period_ATR=14;                               //ATR period (method #3)

input double               step_PSAR=0.02;                              //PSAR step (method #4)
input double               maximum_PSAR=0.2;                            //Maximum PSAR (method #4)

input int                  ma_period=34;                                //MA period (method #5)
input ENUM_MA_METHOD       ma_method=MODE_SMA;                          //Averaging method (method #5)
input ENUM_APPLIED_PRICE   applied_price=PRICE_CLOSE;                   //Price type (method #5)

input double               PercentProfit=50;                            //Percent of profit (method #6)

For a more convenient display of selected parameters during visual testing and demo operation, I have added a panel using information provided in the Graphical Interfaces series. It provides the main type of selected settings:

  • Type of strategy
  • Type of trailing stop
  • Type of money management
  • Take Profit
  • Stop Loss

For the display, the CDonchianUI class was developed, which is available in the file DonchianUI.mqh. If desired, you can add your own values. The panel is shown in Fig.5.

Fig.5. Information panel with the main modes of Donchian Expert.

Testing

Before launching the testing, we need to determine its conditions. The basic conditions are summarized in the below table:

Parameter Value
Testing interval 01.03.2016 — 01.03.2017
Market EURUSD/GOLD-6.17
Execution Every tick based on real ticks
Initial Deposit 1000 USD
Leverage  1:500
Server MetaQuotes

The Expert Advisor is presented in the 4-in-1 format, so there is no need in describing the widest choice of all possible combinations of settings. Let us single out the main blocks of settings, which will be combined during testing, and some individual parameters from these blocks will be optimized. For better understanding, the below table provides the Expert Advisor modes that will be changed during testing:

Expert Advisor block Testing Modes
Money Management Fixed lot/Balance
Working Timeframe M30 - D1
Position Management Trailing Stop/None
Strategy Type Donchian/Donchian+ADX/Donchian+MACD/Donchian+Avr.Speed+RSI

I will explain why only 2 modes are used for Money Management: during testing, the deposit will only be loaded by our Expert Advisor, and only one position will exist at a time, so modes of Balance and Free margin will actually be the same. 

1. The Donchian Channel trading strategy.

We start with the strategy using purely Donchian channels.


Fig. 6. The Donchian trading strategy on EURUSD.

During strategy testing and optimization on EURUSD, we made the following conclusions:

  • In the given range, the best results were obtained on M30-H1.
  • The indicator operation timeframe was set to 10-12.
  • In terms of the price used, the best results were obtained in the CLOSE_HIGH_LOW mode.
  • The efficiency of the trailing stop function was very low compared to the mode without it.
  • The general conclusion: A strategy based only on the Donchian channel behaved as a classical trend strategy, having a series of profitable trades during strong market movements.
//+------------------------------------------------------------------+
//| Expert Advisor input parameters                                  |
//+------------------------------------------------------------------+
sinput string              Inp_EaComment="Donchian Expert";             //EA comment
input double               Inp_Lot=0.01;                                //Basic lot
input MarginMode           Inp_MMode=LOT;                               //Money Management
input int                  Inp_MagicNum=555;                            //Magic
input int                  Inp_StopLoss=400;                            //Stop Loss (in points)
input int                  Inp_TakeProfit=600;                          //Take Profit (in points)
input int                  Inp_Deviation = 20;                          //Deviation
input ENUM_TIMEFRAMES      InpInd_Timeframe=PERIOD_M30;                 //Working timeframe
input bool                 InfoPanel=false;                             //Display of the information panel
//--- Donchian Channel System indicator parameters

input uint                 DonchianPeriod=10;                           //Channel period
input Applied_Extrem       Extremes=CLOSE_HIGH_LOW;                     //Type of extrema
//--- Selecting the strategy

input Strategy             CurStrategy=Donchian;                        //The selected strategy

//--- Trailing Stop parameters

input bool                 UseTrailing=false;                           //Use of trailing stop


As compared with the currency pair, testing on the GOLD-6.17 futures with the same period and timeframes - M30-H1, produced better results. 


Fig.7. The Donchian trading strategy on GOLD-6.17.

//+------------------------------------------------------------------+
//| Expert Advisor input parameters                                  |
//+------------------------------------------------------------------+
sinput string              Inp_EaComment="Donchian Expert";             //EA comment
input double               Inp_Lot=0.01;                                //Basic lot
input MarginMode           Inp_MMode=LOT;                               //Money Management
input int                  Inp_MagicNum=555;                            //Magic
input int                  Inp_StopLoss=400;                            //Stop Loss (in points)
input int                  Inp_TakeProfit=600;                          //Take Profit (in points)
input int                  Inp_Deviation = 20;                          //Deviation
input ENUM_TIMEFRAMES      InpInd_Timeframe=PERIOD_M30;                 //Working timeframe
input bool                 InfoPanel=false;                             //Display of the information panel
//--- Donchian Channel System indicator parameters

input uint                 DonchianPeriod=12;                           //Channel period
input Applied_Extrem       Extremes=CLOSE_HIGH_LOW;                     //Type of extrema
//--- Selecting the strategy

input Strategy             CurStrategy=Donchian;                        //The selected strategy
....

//--- Trailing Stop parameters

input bool                 UseTrailing=true;                            //Use of trailing stop
input bool                 VirtualTrailingStop=false;                   //Virtual trailing stop
input TrallMethod          parameters_trailing=7;                       //Trailing method

input ENUM_TIMEFRAMES      TF_Tralling=PERIOD_CURRENT;                  //Indicator timeframe

input int                  StepTrall=50;                                //Stop level trailing step (in points)
input int                  StartTrall=100;                              //Minimum trailing profit (in points)

2. The Donchian Channel and ADX trading strategy.

After testing the strategy with ADX used to filter the Donchian channel signals, we made the following conclusions:

  • The EA executed less trades, which had been expected. 
  • The best working timeframe was again M30.
  • The percentage of profitable trades was higher.
  • The effective channel period was 18, and ADX period was 10.
  • Again, the most effective price for the channel was CLOSE_HIGH_LOW.


Fig.8. Donchian + ADX trading strategy on EURUSD.

//+------------------------------------------------------------------+
//| Expert Advisor input parameters                                  |
//+------------------------------------------------------------------+
sinput string              Inp_EaComment="Donchian Expert";             //EA comment
input double               Inp_Lot=0.01;                                //Basic lot
input MarginMode           Inp_MMode=LOT;                               //Money Management
input int                  Inp_MagicNum=555;                            //Magic
input int                  Inp_StopLoss=400;                            //Stop Loss (in points)
input int                  Inp_TakeProfit=600;                          //Take Profit (in points)
input int                  Inp_Deviation = 20;                          //Deviation
input ENUM_TIMEFRAMES      InpInd_Timeframe=PERIOD_M30;                 //Working timeframe
input bool                 InfoPanel=false;                             //Display of the information panel
//--- Donchian Channel System indicator parameters

input uint                 DonchianPeriod=18;                           //Channel period
input Applied_Extrem       Extremes=CLOSE_HIGH_LOW;                     //Type of extrema
//--- Selecting the strategy

input Strategy             CurStrategy=Donchian_ADX;                    //The selected strategy
//--- ADX indicator parameter

input int                  ADX_period=10;
input double               ADX_level=20;

Testing on futures showed that on the H1 timeframe, with the Donchian channel period equal to 10 and ADX period equal to 8, the results are similar to the previous strategy. Again, the best results were obtained when drawing the channel based on Close prices.


Fig.9. The Donchian + ADX trading strategy on GOLD-6.17.

//+------------------------------------------------------------------+
//| Expert Advisor input parameters                                  |
//+------------------------------------------------------------------+
sinput string              Inp_EaComment="Donchian Expert";             //EA comment
input double               Inp_Lot=0.01;                                //Basic lot
input MarginMode           Inp_MMode=LOT;                               //Money Management
input int                  Inp_MagicNum=555;                            //Magic
input int                  Inp_StopLoss=400;                            //Stop Loss (in points)
input int                  Inp_TakeProfit=600;                          //Take Profit (in points)
input int                  Inp_Deviation = 20;                          //Deviation
input ENUM_TIMEFRAMES      InpInd_Timeframe=PERIOD_H1;                  //Working timeframe
input bool                 InfoPanel=false;                             //Display of the information panel
//--- Donchian Channel System indicator parameters

input uint                 DonchianPeriod=18;                           //Channel period
input Applied_Extrem       Extremes=CLOSE_HIGH_LOW;                     //Type of extrema
//--- Selecting the strategy

input Strategy             CurStrategy=Donchian_ADX;                    //The selected strategy
//--- ADX indicator parameter

input int                  ADX_period=8;
input double               ADX_level=20;

//--- Trailing Stop parameters

input bool                 UseTrailing=true;                            //Use of trailing stop
input bool                 VirtualTrailingStop=false;                   //Virtual trailing stop
input TrallMethod          parameters_trailing=7;                       //Trailing method

input ENUM_TIMEFRAMES      TF_Tralling=PERIOD_CURRENT;                  //Indicator timeframe

input int                  StepTrall=50;                                //Trailing step (in points)
input int                  StartTrall=100;                              //Minimum trailing profit (in points)

3. The Donchian Channel and MACD trading strategy.

After testing the strategy with MACD used to filter the Donchian channel signals, we made the following conclusions:

  • Once again, the best results were obtained on the H1 timeframe.
  • Changing MACD parameters didn't have any serious effect.


Figure 10. Donchian + MACD trading strategy on EURUSD.

//+------------------------------------------------------------------+
//| Expert Advisor input parameters                                  |
//+------------------------------------------------------------------+
sinput string              Inp_EaComment="Donchian Expert";             //EA comment
input double               Inp_Lot=0.01;                                //Basic lot
input MarginMode           Inp_MMode=LOT;                               //Money Management
input int                  Inp_MagicNum=555;                            //Magic
input int                  Inp_StopLoss=400;                            //Stop Loss (in points)
input int                  Inp_TakeProfit=600;                          //Take Profit (in points)
input int                  Inp_Deviation = 20;                          //Deviation
input ENUM_TIMEFRAMES      InpInd_Timeframe=PERIOD_H1;                  //Working timeframe
input bool                 InfoPanel=true;                              //Display of the information panel
//--- Donchian Channel System indicator parameters

input uint                 DonchianPeriod=16;                           //Channel period
input Applied_Extrem       Extremes=CLOSE_HIGH_LOW;                     //Type of extrema
//--- Selecting the strategy

input Strategy             CurStrategy=Donchian_MACD;                   //The selected strategy

//--- MACD indicator parameters

input int                  InpFastEMA=12;                               //Fast EMA period
input int                  InpSlowEMA=26;                               //Slow EMA period
input int                  InpSignalSMA=9;                              //Signal SMA period
input ENUM_APPLIED_PRICE   InpAppliedPrice=PRICE_CLOSE;                 //Applied price

When tested with futures, the best result was obtained with the Donchian channel period equal to 10, as in the previous strategy. A version with the trailing stop function was more efficient, than without it.


Fig.11. The Donchian + MACD trading strategy on GOLD-6.17.

//+------------------------------------------------------------------+
//| Expert Advisor input parameters                                  |
//+------------------------------------------------------------------+
sinput string              Inp_EaComment="Donchian Expert";             //EA comment
input double               Inp_Lot=0.01;                                //Basic lot
input MarginMode           Inp_MMode=LOT;                               //Money Management
input int                  Inp_MagicNum=555;                            //Magic
input int                  Inp_StopLoss=400;                            //Stop Loss (in points)
input int                  Inp_TakeProfit=600;                          //Take Profit (in points)
input int                  Inp_Deviation = 20;                          //Deviation
input ENUM_TIMEFRAMES      InpInd_Timeframe=PERIOD_M30;                 //Working timeframe
input bool                 InfoPanel=true;                              //Display of the information panel
//--- Donchian Channel System indicator parameters

input uint                 DonchianPeriod=10;                           //Channel period
input Applied_Extrem       Extremes=CLOSE_HIGH_LOW;                     //Type of extrema
//--- Selecting the strategy

input Strategy             CurStrategy=Donchian_MACD;                   //The selected strategy

//--- MACD indicator parameters

input int                  InpFastEMA=12;                               //Fast EMA period
input int                  InpSlowEMA=26;                               //Slow EMA period
input int                  InpSignalSMA=9;                              //Signal SMA period
input ENUM_APPLIED_PRICE   InpAppliedPrice=PRICE_CLOSE;                 //Applied price

Before proceeding to the next strategy with a complex filter, we should draw an intermediate conclusion based on the above strategies using classical indicators. There was not much difference between the tested strategies on EURUSD. However, the ADX and MACD filters reduced the number of market entries and increased the final result. In connection with the specifics of the futures market and its volatility, which differs much from currency pairs, filtering of Donchian signals didn't provide changes. However, the total results on futures were much better compared to the currency pair.

4. The Donchian Channel and Average Speed+X4Period_RSI_Arrows.

By optimizing the strategy of the Donchian channel combined with complex filter, we confirmed the conclusions about the strategy use in different trading conditions. Due to the low volatility of futures, the selectivity of this strategy was too high.


Fig.12. Donchian + Average Speed+X4Period_RSI_Arrows on EURUSD.

//+------------------------------------------------------------------+
//| Expert Advisor input parameters                                  |
//+------------------------------------------------------------------+
sinput string              Inp_EaComment="Donchian Expert";             //EA comment
input double               Inp_Lot=0.01;                                //Basic lot
input MarginMode           Inp_MMode=LOT;                               //Money Management
input int                  Inp_MagicNum=555;                            //Magic
input int                  Inp_StopLoss=400;                            //Stop Loss (in points)
input int                  Inp_TakeProfit=600;                          //Take Profit (in points)
input int                  Inp_Deviation = 20;                          //Deviation
input ENUM_TIMEFRAMES      InpInd_Timeframe=PERIOD_H1;                  //Working timeframe
input bool                 InfoPanel=true;                              //Display of the information panel
//--- Donchian Channel System indicator parameters

input uint                 DonchianPeriod=12;                           //Channel period
input Applied_Extrem       Extremes=CLOSE_HIGH_LOW;                     //Type of extrema
//--- Selecting the strategy

input Strategy             CurStrategy=Donchian_AvrSpeed_RSI;           //The selected strategy

//--- Average Speed indicator parameters

input int                  Inp_Bars=1;                                  //Number of bars
input ENUM_APPLIED_PRICE   Price=PRICE_CLOSE;                           //Applied price
input double               Trend_lev=2;                                 //Trend level
//--- The x4period_rsi_arrows indicator parameters

input uint                 RSIperiod1=7;                                //Period of RSI_1
input uint                 RSIperiod2=12;                               //Period of RSI_2
input uint                 RSIperiod3=18;                               //Period of RSI_3
input uint                 RSIperiod4=32;                               //Period of RSI_4
input ENUM_APPLIED_PRICE   Applied_price=PRICE_WEIGHTED;                //Applied price
input uint                 rsiUpperTrigger=62;                          //Overbought level
input uint                 rsiLowerTrigger=38;                          //Oversold level
//--- Trailing Stop parameters

input bool                 UseTrailing=false;                           //Use of trailing stop

Summary

After testing the trading system based on the Donchian channel, we made the following conclusions and notes about the strategy features:

  • Trading based on the channel behaves as a classical trend following strategy, and it can be improved by using additional filters.
  • Testing results were better on the futures market.
  • Unlike the classical calculation of the channel borders based on Highs and Lows, the CLOSE_HIGH_LOW (close prices) showed better results. This is connected with the testing symbol — the EURUSD market is characterized with price spikes in the form of long shadows. Such spikes distort channel borders, while close prices tend to be more objective.
  • Also, the best results were obtained on timeframes М30 — H1, not daily ones.
  • And the effective period ranges from 10 to 20 candlesticks.

Conclusion

The archive attached below contains all described files properly sorted into folders. For a correct operation, you should save the MQL5 folder to the terminal's root directory. We also used a graphical interface library EasyAndFastGUI, which is available in the related article.

Programs used in the article:

#
 Name
Type
Description
1
DonchianExpert.mq5 Expert Advisor
 A complex Expert Advisor combining 4 strategies based on the Donchian Channel.
2
DonchianUI.mqh Code Base  The GUI class
3
TradeFunctions.mqh Code Base  The class of trade functions.
4
Trailing.mqh Code Base  Open position management class.
5
average_speed.mq5 Indicator  Indicator of the average price change speed.
6
donchian_channels_system.mq5 Indicator  The Donchian Channel displaying candlesticks that break the channel borders.
7 x4period_rsi_arrows.mq5 Indicator  A semaphore indicator containing four RSIs with different period.



Translated from Russian by MetaQuotes Ltd.
Original article: https://www.mql5.com/ru/articles/3146

Attached files |
MQL5.zip (625.3 KB)
Last comments | Go to discussion (8)
fexception
fexception | 6 Apr 2019 at 23:16
Alexander Fedosov:

Fixed. 

It works perfect now, thank you! Does it make sense to use open prices only when optimizing? Or for the best results use every tick / based on real ticks?

riskreward2017
riskreward2017 | 18 Apr 2019 at 18:46
How do we insert these files into Meta5 platform? There's already a folder named MQL5 in the root directory. Are we supposed to overwrite it? Or are we supposed separately copy and paste the ingredients of the Experts, Include, Images and Indicators to the folders with the same names in the MQL5 folder?
Marco vd Heijden
Marco vd Heijden | 18 Apr 2019 at 19:19
riskreward2017:
How do we insert these files into Meta5 platform? There's already a folder named MQL5 in the root directory. Are we supposed to overwrite it? Or are we supposed separately copy and paste the ingredients of the Experts, Include, Images and Indicators to the folders with the same names in the MQL5 folder?

The files are just added to the already existing folders.

Sathish Collection
Sathish Collection | 8 Jul 2023 at 05:20

Hi,

Am getting this below kind of error. it's not fixed. Please share fixed code.


  'ENUM_SORT_MODE::SORT_ASCENDING' will be used instead of 'ENUM_SORT_MODE::SORT_ASCEND' CanvasTable.mqh 1658 53

implicit conversion from 'enum ENUM_SORT_MODE' to 'enum ENUM_SORT_MODE' CanvasTable.mqh 1658 53


Regards,

Sathish

Sathish Collection
Sathish Collection | 8 Jul 2023 at 05:32

Hi Fexception,

Please fix below error at compiling for MT5.


'DonchianExpert.mq5' DonchianExpert.mq5 1 1

'TradeFunctions.mqh' TradeFunctions.mqh 1 1

'PositionInfo.mqh' PositionInfo.mqh 1 1

'Object.mqh' Object.mqh 1 1

'StdLibErr.mqh' StdLibErr.mqh 1 1

'Trailing.mqh' Trailing.mqh 1 1

'DonchianUI.mqh' DonchianUI.mqh 1 1

'WndEvents.mqh' WndEvents.mqh 1 1

'Defines.mqh' Defines.mqh 1 1

'WndContainer.mqh' WndContainer.mqh 1 1

'Window.mqh' Window.mqh 1 1

'ElementBase.mqh' ElementBase.mqh 1 1

'Mouse.mqh' Mouse.mqh 1 1

'Objects.mqh' Objects.mqh 1 1

'Enums.mqh' Enums.mqh 1 1

'Fonts.mqh' Fonts.mqh 1 1

'LineChart.mqh' LineChart.mqh 1 1

'ChartCanvas.mqh' ChartCanvas.mqh 1 1

'CustomCanvas.mqh' CustomCanvas.mqh 1 1

'Colors.mqh' Colors.mqh 1 1

'FileBin.mqh' FileBin.mqh 1 1

'File.mqh' File.mqh 1 1

'Rect.mqh' Rect.mqh 1 1

'ChartObjectsBmpControls.mqh' ChartObjectsBmpControls.mqh 1 1

'ChartObject.mqh' ChartObject.mqh 1 1

'ArrayInt.mqh' ArrayInt.mqh 1 1

'Array.mqh' Array.mqh 1 1

'ArrayDouble.mqh' ArrayDouble.mqh 1 1

'ArrayString.mqh' ArrayString.mqh 1 1

'ArrayObj.mqh' ArrayObj.mqh 1 1

'ChartObjectSubChart.mqh' ChartObjectSubChart.mqh 1 1

'ChartObjectsTxtControls.mqh' ChartObjectsTxtControls.mqh 1 1

'Chart.mqh' Chart.mqh 1 1

'MenuBar.mqh' MenuBar.mqh 1 1

'Element.mqh' Element.mqh 1 1

'MenuItem.mqh' MenuItem.mqh 1 1

'' - double quotes are needed MenuItem.mqh 228 119

'ContextMenu.mqh' ContextMenu.mqh 1 1

'SeparateLine.mqh' SeparateLine.mqh 1 1

'SimpleButton.mqh' SimpleButton.mqh 1 1

'IconButton.mqh' IconButton.mqh 1 1

'SplitButton.mqh' SplitButton.mqh 1 1

'ButtonsGroup.mqh' ButtonsGroup.mqh 1 1

'IconButtonsGroup.mqh' IconButtonsGroup.mqh 1 1

'RadioButtons.mqh' RadioButtons.mqh 1 1

'StatusBar.mqh' StatusBar.mqh 1 1

'Tooltip.mqh' Tooltip.mqh 1 1

'ListView.mqh' ListView.mqh 1 1

'Scrolls.mqh' Scrolls.mqh 1 1

'ComboBox.mqh' ComboBox.mqh 1 1

'CheckBox.mqh' CheckBox.mqh 1 1

'SpinEdit.mqh' SpinEdit.mqh 1 1

'CheckBoxEdit.mqh' CheckBoxEdit.mqh 1 1

'CheckComboBox.mqh' CheckComboBox.mqh 1 1

'Slider.mqh' Slider.mqh 1 1

'DualSlider.mqh' DualSlider.mqh 1 1

'LabelsTable.mqh' LabelsTable.mqh 1 1

'Table.mqh' Table.mqh 1 1

'CanvasTable.mqh' CanvasTable.mqh 1 1

'Pointer.mqh' Pointer.mqh 1 1

'Tabs.mqh' Tabs.mqh 1 1

'IconTabs.mqh' IconTabs.mqh 1 1

'Calendar.mqh' Calendar.mqh 1 1

'DateTime.mqh' DateTime.mqh 1 1

'DropCalendar.mqh' DropCalendar.mqh 1 1

'TreeItem.mqh' TreeItem.mqh 1 1

'TreeView.mqh' TreeView.mqh 1 1

'FileNavigator.mqh' FileNavigator.mqh 1 1

'ColorButton.mqh' ColorButton.mqh 1 1

'ColorPicker.mqh' ColorPicker.mqh 1 1

'ProgressBar.mqh' ProgressBar.mqh 1 1

'IndicatorBar.mqh' IndicatorBar.mqh 1 1

'LineGraph.mqh' LineGraph.mqh 1 1

'StandardChart.mqh' StandardChart.mqh 1 1

'TextBox.mqh' TextBox.mqh 1 1

'Keys.mqh' Keys.mqh 1 1

'KeyCodes.mqh' KeyCodes.mqh 1 1

'TimeCounter.mqh' TimeCounter.mqh 1 1

'TextEdit.mqh' TextEdit.mqh 1 1

'TextLabel.mqh' TextLabel.mqh 1 1

'Picture.mqh' Picture.mqh 1 1

'PicturesSlider.mqh' PicturesSlider.mqh 1 1

'TimeEdit.mqh' TimeEdit.mqh 1 1

'CheckBoxList.mqh' CheckBoxList.mqh 1 1

'TrailingStop' - unexpected token, probably type is missing? Trailing.mqh 114 12

function 'CTrailing::TrailingStop' already defined and has different return type Trailing.mqh 114 12

   see declaration of function 'CTrailing::TrailingStop' Trailing.mqh 83 22

'iLow' - override system function Trailing.mqh 241 8

'iHigh' - override system function Trailing.mqh 251 8

identifier 'ENUM_SORT_MODE' already used Enums.mqh 104 6

'advisor.bmp' as resource "::Images\EasyAndFastGUI\Icons\bmp16\advisor.bmp" advisor.bmp 1 1

'indicator.bmp' as resource "::Images\EasyAndFastGUI\Icons\bmp16\indicator.bmp" indicator.bmp 1 1

'script.bmp' as resource "::Images\EasyAndFastGUI\Icons\bmp16\script.bmp" script.bmp 1 1

'Close_red.bmp' as resource "::Images\EasyAndFastGUI\Controls\Close_red.bmp" Close_red.bmp 1 1

'Close_black.bmp' as resource "::Images\EasyAndFastGUI\Controls\Close_black.bmp" Close_black.bmp 1 1

'DropOn_black.bmp' as resource "::Images\EasyAndFastGUI\Controls\DropOn_black.bmp" DropOn_black.bmp 1 1

'DropOn_white.bmp' as resource "::Images\EasyAndFastGUI\Controls\DropOn_white.bmp" DropOn_white.bmp 1 1

'DropOff_black.bmp' as resource "::Images\EasyAndFastGUI\Controls\DropOff_black.bmp" DropOff_black.bmp 1 1

'DropOff_white.bmp' as resource "::Images\EasyAndFastGUI\Controls\DropOff_white.bmp" DropOff_white.bmp 1 1

'Help_dark.bmp' as resource "::Images\EasyAndFastGUI\Controls\Help_dark.bmp" Help_dark.bmp 1 1

'Help_light.bmp' as resource "::Images\EasyAndFastGUI\Controls\Help_light.bmp" Help_light.bmp 1 1

'CheckBoxOn_min_gray.bmp' as resource "::Images\EasyAndFastGUI\Controls\CheckBoxOn_min_gray.bmp" CheckBoxOn_min_gray.bmp 1 1

'CheckBoxOn_min_white.bmp' as resource "::Images\EasyAndFastGUI\Controls\CheckBoxOn_min_white.bmp" CheckBoxOn_min_white.bmp 1 1

'RArrow.bmp' as resource "::Images\EasyAndFastGUI\Controls\RArrow.bmp" RArrow.bmp 1 1

'RArrow_white.bmp' as resource "::Images\EasyAndFastGUI\Controls\RArrow_white.bmp" RArrow_white.bmp 1 1

'DropOff.bmp' as resource "::Images\EasyAndFastGUI\Controls\DropOff.bmp" DropOff.bmp 1 1

'radio_button_on.bmp' as resource "::Images\EasyAndFastGUI\Controls\radio_button_on.bmp" radio_button_on.bmp 1 1

'radio_button_off.bmp' as resource "::Images\EasyAndFastGUI\Controls\radio_button_off.bmp" radio_button_off.bmp 1 1

'radio_button_on_locked.bmp' as resource "::Images\EasyAndFastGUI\Controls\radio_button_on_locked.bmp" radio_button_on_locked.bmp 1 1

'radio_button_off_locked.bmp' as resource "::Images\EasyAndFastGUI\Controls\radio_button_off_locked.bmp" radio_button_off_locked.bmp 1 1

'UArrow_min.bmp' as resource "::Images\EasyAndFastGUI\Controls\UArrow_min.bmp" UArrow_min.bmp 1 1

'UArrow_min_dark.bmp' as resource "::Images\EasyAndFastGUI\Controls\UArrow_min_dark.bmp" UArrow_min_dark.bmp 1 1

'LArrow_min.bmp' as resource "::Images\EasyAndFastGUI\Controls\LArrow_min.bmp" LArrow_min.bmp 1 1

'LArrow_min_dark.bmp' as resource "::Images\EasyAndFastGUI\Controls\LArrow_min_dark.bmp" LArrow_min_dark.bmp 1 1

'DArrow_min.bmp' as resource "::Images\EasyAndFastGUI\Controls\DArrow_min.bmp" DArrow_min.bmp 1 1

'DArrow_min_dark.bmp' as resource "::Images\EasyAndFastGUI\Controls\DArrow_min_dark.bmp" DArrow_min_dark.bmp 1 1

'RArrow_min.bmp' as resource "::Images\EasyAndFastGUI\Controls\RArrow_min.bmp" RArrow_min.bmp 1 1

'RArrow_min_dark.bmp' as resource "::Images\EasyAndFastGUI\Controls\RArrow_min_dark.bmp" RArrow_min_dark.bmp 1 1

'CheckBoxOn.bmp' as resource "::Images\EasyAndFastGUI\Controls\CheckBoxOn.bmp" CheckBoxOn.bmp 1 1

'CheckBoxOff.bmp' as resource "::Images\EasyAndFastGUI\Controls\CheckBoxOff.bmp" CheckBoxOff.bmp 1 1

'CheckBoxOn_locked.bmp' as resource "::Images\EasyAndFastGUI\Controls\CheckBoxOn_locked.bmp" CheckBoxOn_locked.bmp 1 1

'CheckBoxOff_locked.bmp' as resource "::Images\EasyAndFastGUI\Controls\CheckBoxOff_locked.bmp" CheckBoxOff_locked.bmp 1 1

'SpinInc.bmp' as resource "::Images\EasyAndFastGUI\Controls\SpinInc.bmp" SpinInc.bmp 1 1

'SpinInc_blue.bmp' as resource "::Images\EasyAndFastGUI\Controls\SpinInc_blue.bmp" SpinInc_blue.bmp 1 1

'SpinDec.bmp' as resource "::Images\EasyAndFastGUI\Controls\SpinDec.bmp" SpinDec.bmp 1 1

'SpinDec_blue.bmp' as resource "::Images\EasyAndFastGUI\Controls\SpinDec_blue.bmp" SpinDec_blue.bmp 1 1

'SORT_ASCEND' - improper enumerator cannot be used Table.mqh 220 88

'SORT_ASCEND' - improper enumerator cannot be used Table.mqh 1686 80

'pointer_x_rs.bmp' as resource "::Images\EasyAndFastGUI\Controls\pointer_x_rs.bmp" pointer_x_rs.bmp 1 1

'pointer_x_rs_blue.bmp' as resource "::Images\EasyAndFastGUI\Controls\pointer_x_rs_blue.bmp" pointer_x_rs_blue.bmp 1 1

'pointer_y_rs.bmp' as resource "::Images\EasyAndFastGUI\Controls\pointer_y_rs.bmp" pointer_y_rs.bmp 1 1

'pointer_y_rs_blue.bmp' as resource "::Images\EasyAndFastGUI\Controls\pointer_y_rs_blue.bmp" pointer_y_rs_blue.bmp 1 1

'pointer_xy1_rs.bmp' as resource "::Images\EasyAndFastGUI\Controls\pointer_xy1_rs.bmp" pointer_xy1_rs.bmp 1 1

'pointer_xy1_rs_blue.bmp' as resource "::Images\EasyAndFastGUI\Controls\pointer_xy1_rs_blue.bmp" pointer_xy1_rs_blue.bmp 1 1

'pointer_xy2_rs.bmp' as resource "::Images\EasyAndFastGUI\Controls\pointer_xy2_rs.bmp" pointer_xy2_rs.bmp 1 1

'pointer_xy2_rs_blue.bmp' as resource "::Images\EasyAndFastGUI\Controls\pointer_xy2_rs_blue.bmp" pointer_xy2_rs_blue.bmp 1 1

'pointer_x_rs_rel.bmp' as resource "::Images\EasyAndFastGUI\Controls\pointer_x_rs_rel.bmp" pointer_x_rs_rel.bmp 1 1

'pointer_y_rs_rel.bmp' as resource "::Images\EasyAndFastGUI\Controls\pointer_y_rs_rel.bmp" pointer_y_rs_rel.bmp 1 1

'pointer_x_scroll.bmp' as resource "::Images\EasyAndFastGUI\Controls\pointer_x_scroll.bmp" pointer_x_scroll.bmp 1 1

'pointer_x_scroll_blue.bmp' as resource "::Images\EasyAndFastGUI\Controls\pointer_x_scroll_blue.bmp" pointer_x_scroll_blue.bmp 1 1

'pointer_y_scroll.bmp' as resource "::Images\EasyAndFastGUI\Controls\pointer_y_scroll.bmp" pointer_y_scroll.bmp 1 1

'pointer_y_scroll_blue.bmp' as resource "::Images\EasyAndFastGUI\Controls\pointer_y_scroll_blue.bmp" pointer_y_scroll_blue.bmp 1 1

'pointer_text_select.bmp' as resource "::Images\EasyAndFastGUI\Controls\pointer_text_select.bmp" pointer_text_select.bmp 1 1

'SORT_ASCEND' - improper enumerator cannot be used CanvasTable.mqh 309 88

'SORT_ASCEND' - improper enumerator cannot be used CanvasTable.mqh 1633 86

'LeftTransp_black.bmp' as resource "::Images\EasyAndFastGUI\Controls\LeftTransp_black.bmp" LeftTransp_black.bmp 1 1

'LeftTransp_blue.bmp' as resource "::Images\EasyAndFastGUI\Controls\LeftTransp_blue.bmp" LeftTransp_blue.bmp 1 1

'RArrow_black.bmp' as resource "::Images\EasyAndFastGUI\Controls\RArrow_black.bmp" RArrow_black.bmp 1 1

'RArrow_blue.bmp' as resource "::Images\EasyAndFastGUI\Controls\RArrow_blue.bmp" RArrow_blue.bmp 1 1

'calendar_today.bmp' as resource "::Images\EasyAndFastGUI\Controls\calendar_today.bmp" calendar_today.bmp 1 1

'calendar_drop_on.bmp' as resource "::Images\EasyAndFastGUI\Controls\calendar_drop_on.bmp" calendar_drop_on.bmp 1 1

'calendar_drop_off.bmp' as resource "::Images\EasyAndFastGUI\Controls\calendar_drop_off.bmp" calendar_drop_off.bmp 1 1

'calendar_drop_locked.bmp' as resource "::Images\EasyAndFastGUI\Controls\calendar_drop_locked.bmp" calendar_drop_locked.bmp 1 1

'RArrow_rotate_black.bmp' as resource "::Images\EasyAndFastGUI\Controls\RArrow_rotate_black.bmp" RArrow_rotate_black.bmp 1 1

'RArrow_rotate_white.bmp' as resource "::Images\EasyAndFastGUI\Controls\RArrow_rotate_white.bmp" RArrow_rotate_white.bmp 1 1

'folder_w10.bmp' as resource "::Images\EasyAndFastGUI\Icons\bmp16\folder_w10.bmp" folder_w10.bmp 1 1

'text_file_w10.bmp' as resource "::Images\EasyAndFastGUI\Icons\bmp16\text_file_w10.bmp" text_file_w10.bmp 1 1

'arrow_down.bmp' as resource "::Images\EasyAndFastGUI\Icons\bmp16\arrow_down.bmp" arrow_down.bmp 1 1

'arrow_up.bmp' as resource "::Images\EasyAndFastGUI\Icons\bmp16\arrow_up.bmp" arrow_up.bmp 1 1

'stop_gray.bmp' as resource "::Images\EasyAndFastGUI\Icons\bmp16\stop_gray.bmp" stop_gray.bmp 1 1

'no_image.bmp' as resource "::Images\EasyAndFastGUI\Icons\bmp64\no_image.bmp" no_image.bmp 1 1

'ArrowLeft.bmp' as resource "::Images\EasyAndFastGUI\Controls\ArrowLeft.bmp" ArrowLeft.bmp 1 1

'ArrowLeft_blue.bmp' as resource "::Images\EasyAndFastGUI\Controls\ArrowLeft_blue.bmp" ArrowLeft_blue.bmp 1 1

'ArrowRight.bmp' as resource "::Images\EasyAndFastGUI\Controls\ArrowRight.bmp" ArrowRight.bmp 1 1

'ArrowRight_blue.bmp' as resource "::Images\EasyAndFastGUI\Controls\ArrowRight_blue.bmp" ArrowRight_blue.bmp 1 1

'iLow' - ambiguous call to overloaded function with the same parameters Trailing.mqh 278 36

could be one of 2 function(s) Trailing.mqh 278 36

   built-in: double iLow(const string,ENUM_TIMEFRAMES,int) Trailing.mqh 278 36

   double iLow(string,ENUM_TIMEFRAMES,int) Trailing.mqh 241 8

'iHigh' - ambiguous call to overloaded function with the same parameters Trailing.mqh 287 36

could be one of 2 function(s) Trailing.mqh 287 36

   built-in: double iHigh(const string,ENUM_TIMEFRAMES,int) Trailing.mqh 287 36

   double iHigh(string,ENUM_TIMEFRAMES,int) Trailing.mqh 251 8

'iLow' - ambiguous call to overloaded function with the same parameters Trailing.mqh 299 19

could be one of 2 function(s) Trailing.mqh 299 19

   built-in: double iLow(const string,ENUM_TIMEFRAMES,int) Trailing.mqh 299 19

   double iLow(string,ENUM_TIMEFRAMES,int) Trailing.mqh 241 8

'iLow' - ambiguous call to overloaded function with the same parameters Trailing.mqh 299 50

could be one of 2 function(s) Trailing.mqh 299 50

   built-in: double iLow(const string,ENUM_TIMEFRAMES,int) Trailing.mqh 299 50

   double iLow(string,ENUM_TIMEFRAMES,int) Trailing.mqh 241 8

'iLow' - ambiguous call to overloaded function with the same parameters Trailing.mqh 300 19

could be one of 2 function(s) Trailing.mqh 300 19

   built-in: double iLow(const string,ENUM_TIMEFRAMES,int) Trailing.mqh 300 19

   double iLow(string,ENUM_TIMEFRAMES,int) Trailing.mqh 241 8

'iLow' - ambiguous call to overloaded function with the same parameters Trailing.mqh 300 50

could be one of 2 function(s) Trailing.mqh 300 50

   built-in: double iLow(const string,ENUM_TIMEFRAMES,int) Trailing.mqh 300 50

   double iLow(string,ENUM_TIMEFRAMES,int) Trailing.mqh 241 8

'iLow' - ambiguous call to overloaded function with the same parameters Trailing.mqh 301 19

could be one of 2 function(s) Trailing.mqh 301 19

   built-in: double iLow(const string,ENUM_TIMEFRAMES,int) Trailing.mqh 301 19

   double iLow(string,ENUM_TIMEFRAMES,int) Trailing.mqh 241 8

'iLow' - ambiguous call to overloaded function with the same parameters Trailing.mqh 301 50

could be one of 2 function(s) Trailing.mqh 301 50

   built-in: double iLow(const string,ENUM_TIMEFRAMES,int) Trailing.mqh 301 50

   double iLow(string,ENUM_TIMEFRAMES,int) Trailing.mqh 241 8

'iLow' - ambiguous call to overloaded function with the same parameters Trailing.mqh 303 23

could be one of 2 function(s) Trailing.mqh 303 23

   built-in: double iLow(const string,ENUM_TIMEFRAMES,int) Trailing.mqh 303 23

   double iLow(string,ENUM_TIMEFRAMES,int) Trailing.mqh 241 8

'iHigh' - ambiguous call to overloaded function with the same parameters Trailing.mqh 317 19

could be one of 2 function(s) Trailing.mqh 317 19

   built-in: double iHigh(const string,ENUM_TIMEFRAMES,int) Trailing.mqh 317 19

   double iHigh(string,ENUM_TIMEFRAMES,int) Trailing.mqh 251 8

'iHigh' - ambiguous call to overloaded function with the same parameters Trailing.mqh 317 51

could be one of 2 function(s) Trailing.mqh 317 51

   built-in: double iHigh(const string,ENUM_TIMEFRAMES,int) Trailing.mqh 317 51

   double iHigh(string,ENUM_TIMEFRAMES,int) Trailing.mqh 251 8

'iHigh' - ambiguous call to overloaded function with the same parameters Trailing.mqh 318 19

could be one of 2 function(s) Trailing.mqh 318 19

   built-in: double iHigh(const string,ENUM_TIMEFRAMES,int) Trailing.mqh 318 19

   double iHigh(string,ENUM_TIMEFRAMES,int) Trailing.mqh 251 8

'iHigh' - ambiguous call to overloaded function with the same parameters Trailing.mqh 318 51

could be one of 2 function(s) Trailing.mqh 318 51

   built-in: double iHigh(const string,ENUM_TIMEFRAMES,int) Trailing.mqh 318 51

   double iHigh(string,ENUM_TIMEFRAMES,int) Trailing.mqh 251 8

'iHigh' - ambiguous call to overloaded function with the same parameters Trailing.mqh 319 19

could be one of 2 function(s) Trailing.mqh 319 19

   built-in: double iHigh(const string,ENUM_TIMEFRAMES,int) Trailing.mqh 319 19

   double iHigh(string,ENUM_TIMEFRAMES,int) Trailing.mqh 251 8

'iHigh' - ambiguous call to overloaded function with the same parameters Trailing.mqh 319 51

could be one of 2 function(s) Trailing.mqh 319 51

   built-in: double iHigh(const string,ENUM_TIMEFRAMES,int) Trailing.mqh 319 51

   double iHigh(string,ENUM_TIMEFRAMES,int) Trailing.mqh 251 8

'iHigh' - ambiguous call to overloaded function with the same parameters Trailing.mqh 321 23

could be one of 2 function(s) Trailing.mqh 321 23

   built-in: double iHigh(const string,ENUM_TIMEFRAMES,int) Trailing.mqh 321 23

   double iHigh(string,ENUM_TIMEFRAMES,int) Trailing.mqh 251 8

expression not boolean ChartCanvas.mqh 129 53

'method' - undeclared identifier MenuItem.mqh 228 110

'method' - some operator expected MenuItem.mqh 228 110

implicit conversion from 'enum ENUM_SORT_MODE' to 'enum ENUM_SORT_MODE' Table.mqh 275 46

   'ENUM_SORT_MODE::SORT_ASCENDING' will be used instead of 'ENUM_SORT_MODE::SORT_ASCEND' Table.mqh 275 46

implicit conversion from 'enum ENUM_SORT_MODE' to 'enum ENUM_SORT_MODE' Table.mqh 275 46

   'ENUM_SORT_MODE::SORT_ASCENDING' will be used instead of 'ENUM_SORT_MODE::SORT_ASCEND' Table.mqh 275 46

implicit conversion from 'enum ENUM_SORT_MODE' to 'enum ENUM_SORT_MODE' Table.mqh 975 30

   'ENUM_SORT_MODE::SORT_ASCENDING' will be used instead of 'ENUM_SORT_MODE::SORT_ASCEND' Table.mqh 975 30

implicit conversion from 'enum ENUM_SORT_MODE' to 'enum ENUM_SORT_MODE' Table.mqh 975 30

   'ENUM_SORT_MODE::SORT_ASCENDING' will be used instead of 'ENUM_SORT_MODE::SORT_ASCEND' Table.mqh 975 30

implicit conversion from 'enum ENUM_SORT_MODE' to 'enum ENUM_SORT_MODE' Table.mqh 1070 113

   'ENUM_SORT_MODE::SORT_DESCENDING' will be used instead of 'ENUM_SORT_MODE::SORT_DESCEND' Table.mqh 1070 113

implicit conversion from 'enum ENUM_SORT_MODE' to 'enum ENUM_SORT_MODE' Table.mqh 1071 29

   'ENUM_SORT_MODE::SORT_ASCENDING' will be used instead of 'ENUM_SORT_MODE::SORT_ASCEND' Table.mqh 1071 29

implicit conversion from 'enum ENUM_SORT_MODE' to 'enum ENUM_SORT_MODE' Table.mqh 1071 29

   'ENUM_SORT_MODE::SORT_ASCENDING' will be used instead of 'ENUM_SORT_MODE::SORT_ASCEND' Table.mqh 1071 29

implicit conversion from 'enum ENUM_SORT_MODE' to 'enum ENUM_SORT_MODE' Table.mqh 1073 29

   'ENUM_SORT_MODE::SORT_DESCENDING' will be used instead of 'ENUM_SORT_MODE::SORT_DESCEND' Table.mqh 1073 29

implicit conversion from 'enum ENUM_SORT_MODE' to 'enum ENUM_SORT_MODE' Table.mqh 1073 29

   'ENUM_SORT_MODE::SORT_DESCENDING' will be used instead of 'ENUM_SORT_MODE::SORT_DESCEND' Table.mqh 1073 29

implicit conversion from 'enum ENUM_SORT_MODE' to 'enum ENUM_SORT_MODE' Table.mqh 1081 47

   'ENUM_SORT_MODE::SORT_ASCENDING' will be used instead of 'ENUM_SORT_MODE::SORT_ASCEND' Table.mqh 1081 47

implicit conversion from 'enum ENUM_SORT_MODE' to 'enum ENUM_SORT_MODE' Table.mqh 1703 53

   'ENUM_SORT_MODE::SORT_ASCENDING' will be used instead of 'ENUM_SORT_MODE::SORT_ASCEND' Table.mqh 1703 53

implicit conversion from 'enum ENUM_SORT_MODE' to 'enum ENUM_SORT_MODE' Table.mqh 1711 53

   'ENUM_SORT_MODE::SORT_ASCENDING' will be used instead of 'ENUM_SORT_MODE::SORT_ASCEND' Table.mqh 1711 53

implicit conversion from 'enum ENUM_SORT_MODE' to 'enum ENUM_SORT_MODE' CanvasTable.mqh 444 58

   'ENUM_SORT_MODE::SORT_ASCENDING' will be used instead of 'ENUM_SORT_MODE::SORT_ASCEND' CanvasTable.mqh 444 58

implicit conversion from 'enum ENUM_SORT_MODE' to 'enum ENUM_SORT_MODE' CanvasTable.mqh 444 58

   'ENUM_SORT_MODE::SORT_ASCENDING' will be used instead of 'ENUM_SORT_MODE::SORT_ASCEND' CanvasTable.mqh 444 58

implicit conversion from 'enum ENUM_SORT_MODE' to 'enum ENUM_SORT_MODE' CanvasTable.mqh 1050 30

   'ENUM_SORT_MODE::SORT_ASCENDING' will be used instead of 'ENUM_SORT_MODE::SORT_ASCEND' CanvasTable.mqh 1050 30

implicit conversion from 'enum ENUM_SORT_MODE' to 'enum ENUM_SORT_MODE' CanvasTable.mqh 1050 30

   'ENUM_SORT_MODE::SORT_ASCENDING' will be used instead of 'ENUM_SORT_MODE::SORT_ASCEND' CanvasTable.mqh 1050 30

implicit conversion from 'enum ENUM_SORT_MODE' to 'enum ENUM_SORT_MODE' CanvasTable.mqh 1360 113

   'ENUM_SORT_MODE::SORT_DESCENDING' will be used instead of 'ENUM_SORT_MODE::SORT_DESCEND' CanvasTable.mqh 1360 113

implicit conversion from 'enum ENUM_SORT_MODE' to 'enum ENUM_SORT_MODE' CanvasTable.mqh 1361 29

   'ENUM_SORT_MODE::SORT_ASCENDING' will be used instead of 'ENUM_SORT_MODE::SORT_ASCEND' CanvasTable.mqh 1361 29

implicit conversion from 'enum ENUM_SORT_MODE' to 'enum ENUM_SORT_MODE' CanvasTable.mqh 1361 29

   'ENUM_SORT_MODE::SORT_ASCENDING' will be used instead of 'ENUM_SORT_MODE::SORT_ASCEND' CanvasTable.mqh 1361 29

implicit conversion from 'enum ENUM_SORT_MODE' to 'enum ENUM_SORT_MODE' CanvasTable.mqh 1363 29

   'ENUM_SORT_MODE::SORT_DESCENDING' will be used instead of 'ENUM_SORT_MODE::SORT_DESCEND' CanvasTable.mqh 1363 29

implicit conversion from 'enum ENUM_SORT_MODE' to 'enum ENUM_SORT_MODE' CanvasTable.mqh 1363 29

   'ENUM_SORT_MODE::SORT_DESCENDING' will be used instead of 'ENUM_SORT_MODE::SORT_DESCEND' CanvasTable.mqh 1363 29

implicit conversion from 'enum ENUM_SORT_MODE' to 'enum ENUM_SORT_MODE' CanvasTable.mqh 1650 53

   'ENUM_SORT_MODE::SORT_ASCENDING' will be used instead of 'ENUM_SORT_MODE::SORT_ASCEND' CanvasTable.mqh 1650 53

implicit conversion from 'enum ENUM_SORT_MODE' to 'enum ENUM_SORT_MODE' CanvasTable.mqh 1658 53

   'ENUM_SORT_MODE::SORT_ASCENDING' will be used instead of 'ENUM_SORT_MODE::SORT_ASCEND' CanvasTable.mqh 1658 53

implicit conversion from 'enum ENUM_SORT_MODE' to 'enum ENUM_SORT_MODE' CanvasTable.mqh 2204 44

   'ENUM_SORT_MODE::SORT_ASCENDING' will be used instead of 'ENUM_SORT_MODE::SORT_ASCEND' CanvasTable.mqh 2204 44

28 errors, 25 warnings 29 26


Regards,

Sathish

MQL5 Cookbook - Creating a ring buffer for fast calculation of indicators in a sliding window MQL5 Cookbook - Creating a ring buffer for fast calculation of indicators in a sliding window
The ring buffer is the simplest and the most efficient way to arrange data when performing calculations in a sliding window. The article describes the algorithm and shows how it simplifies calculations in a sliding window and makes them more efficient.
Cross-Platform Expert Advisor: Order Manager Cross-Platform Expert Advisor: Order Manager
This article discusses the creation of an order manager for a cross-platform expert advisor. The order manager is responsible for the entry and exit of orders or positions entered by the expert, as well as for keeping an independent record of such trades that is usable for both versions.
Cross-Platform Expert Advisor: Signals Cross-Platform Expert Advisor: Signals
This article discusses the CSignal and CSignals classes which will be used in cross-platform expert advisors. It examines the differences between MQL4 and MQL5 on how particular data needed for evaluation of trade signals are accessed to ensure that the code written will be compatible with both compilers.
How Long Is the Trend? How Long Is the Trend?
The article highlights several methods for trend identification aiming to determine the trend duration relative to the flat market. In theory, the trend to flat rate is considered to be 30% to 70%. This is what we'll be checking.