Discussion of article "Trading with Donchian Channels"

 

New article Trading with Donchian Channels has been published:

In this article, we develop and tests several strategies based on the Donchian channel using various indicator filters. We also perform a comparative analysis of their operation.

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.

Author: Alexander Fedosov

 

Donchian channel == standard ZigZag - so the signal will be very delayed.

Donchian's channel is good for trawl, and for take profit at counter trend.

 
'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
'SymbolInfo.mqh' SymbolInfo.mqh 1 1
'Trailing.mqh' Trailing.mqh 1 1
'DonchianUI.mqh' DonchianUI.mqh 1 1
can't open "C:\Program Files\RoboForex - MetaTrader 5\MQL5\include\EasyAndFastGUI\WndEvents.mqh" include file DonchianUI.mqh 6 11
'CWndEvents' - declaration without type DonchianUI.mqh 10 28
'CWndEvents' - syntax error DonchianUI.mqh 10 28
'CDonchianUI' - member function not defined DonchianUI.mqh 51 14
'~CDonchianUI' - member function not defined DonchianUI.mqh 57 15
'OnInitEvent' - member function not defined DonchianUI.mqh 63 19
'OnDeinitEvent' - member function not defined DonchianUI.mqh 69 19
'OnTimerEvent' - member function not defined DonchianUI.mqh 77 19
'OnEvent' - member function not defined DonchianUI.mqh 97 19
'CreateMainPanel' - member function not defined DonchianUI.mqh 113 19
'CreateStatusBar' - member function not defined DonchianUI.mqh 141 19
'CreateLabel1' - member function not defined DonchianUI.mqh 168 19
'CreateLabel2' - member function not defined DonchianUI.mqh 187 19
'CreateLabel3' - member function not defined DonchianUI.mqh 206 19
'CreateCanvasTable' - member function not defined DonchianUI.mqh 224 19
'CDonchianUI' - struct undefined DonchianExpert.mq5 19 1
'CWndEvents' - import not defined DonchianUI.mqh 72 4
')' - semicolon expected DonchianUI.mqh 73 3
'OnTimerEvent' - function already defined and has body DonchianUI.mqh 77 19
'OnTimerEvent' - the declaration is not allowed for the current scope DonchianUI.mqh 77 19
'OnEvent' - the function is already defined and has body DonchianUI.mqh 97 19
'OnEvent' - the declaration is not allowed for the current scope DonchianUI.mqh 97 19
'CreateMainPanel' - function already defined and has body DonchianUI.mqh 113 19
'CreateMainPanel' - the declaration is not allowed for the current scope DonchianUI.mqh 113 19
'CreateStatusBar' - the function is already defined and has body DonchianUI.mqh 141 19
'CreateStatusBar' - the declaration is not allowed for the current scope DonchianUI.mqh 141 19
'CreateLabel1' - the function is already defined and has body DonchianUI.mqh 168 19
'CreateLabel1' - the declaration is not allowed for the current scope DonchianUI.mqh 168 19
'CreateLabel2' - the function is already defined and has body DonchianUI.mqh 187 19
'CreateLabel2' - the declaration is not allowed for the current scope DonchianUI.mqh 187 19
'CreateLabel3' - the function is already defined and has body DonchianUI.mqh 206 19
'CreateLabel3' - the declaration is not allowed for the current scope DonchianUI.mqh 206 19
'CreateCanvasTable' - function already defined and has body DonchianUI.mqh 224 19
'CreateCanvasTable' - the declaration is not allowed for the current scope DonchianUI.mqh 224 19
declaration of 'Trade' hides global declaration at line 17 DonchianExpert.mq5 17 13
see previous declaration of 'Trade' DonchianExpert.mq5 17 13
declaration of 'Trall' hides global declaration at line 18 DonchianExpert.mq5 18 13
see previous declaration of 'Trall' DonchianExpert.mq5 18 13
'CDonchianUI' - struct undefined DonchianExpert.mq5 19 1
declaration of 'UI' hides global declaration at line 19 DonchianExpert.mq5 19 13
see previous declaration of 'UI' DonchianExpert.mq5 19 13
enumeration already defined DonchianExpert.mq5 23 6
'Donchian' - enumerator identifier already defined DonchianExpert.mq5 25 4
'Donchian_ADX' - enumerator identifier already defined DonchianExpert.mq5 26 4
'Donchian_MACD' - enumerator identifier already defined DonchianExpert.mq5 27 4
'Donchian_AvrSpeed_RSI' - enumerator identifier already defined DonchianExpert.mq5 28 4
enumeration already defined DonchianExpert.mq5 33 6
'HIGH_LOW' - enumerator identifier already defined DonchianExpert.mq5 35 4
'HIGH_LOW_OPEN' - enumerator identifier already defined DonchianExpert.mq5 36 4
'HIGH_LOW_CLOSE' - enumerator identifier already defined DonchianExpert.mq5 37 4
'OPEN_HIGH_LOW' - enumerator identifier already defined DonchianExpert.mq5 38 4
'CLOSE_HIGH_LOW' - enumerator identifier already defined DonchianExpert.mq5 39 4
'sinput' - unexpected token DonchianExpert.mq5 44 1
declaration of 'Inp_EaComment' hides global declaration at line 44 DonchianExpert.mq5 44 28
see previous declaration of 'Inp_EaComment' DonchianExpert.mq5 44 28
'input' - unexpected token DonchianExpert.mq5 45 1
declaration of 'Inp_Lot' hides global declaration at line 45 DonchianExpert.mq5 45 28
see previous declaration of 'Inp_Lot' DonchianExpert.mq5 45 28
'input' - unexpected token DonchianExpert.mq5 46 1
declaration of 'Inp_MMode' hides global declaration at line 46 DonchianExpert.mq5 46 28
see previous declaration of 'Inp_MMode' DonchianExpert.mq5 46 28
'input' - unexpected token DonchianExpert.mq5 47 1
declaration of 'Inp_MagicNum' hides global declaration at line 47 DonchianExpert.mq5 47 28
see previous declaration of 'Inp_MagicNum' DonchianExpert.mq5 47 28
'input' - unexpected token DonchianExpert.mq5 48 1
declaration of 'Inp_StopLoss' hides global declaration at line 48 DonchianExpert.mq5 48 28
see previous declaration of 'Inp_StopLoss' DonchianExpert.mq5 48 28
'input' - unexpected token DonchianExpert.mq5 49 1
declaration of 'Inp_TakeProfit' hides global declaration at line 49 DonchianExpert.mq5 49 28
see previous declaration of 'Inp_TakeProfit' DonchianExpert.mq5 49 28
'input' - unexpected token DonchianExpert.mq5 50 1
declaration of 'Inp_Deviation' hides global declaration at line 50 DonchianExpert.mq5 50 28
see previous declaration of 'Inp_Deviation' DonchianExpert.mq5 50 28
'input' - unexpected token DonchianExpert.mq5 51 1
declaration of 'InpInd_Timeframe' hides global declaration at line 51 DonchianExpert.mq5 51 28
see previous declaration of 'InpInd_Timeframe' DonchianExpert.mq5 51 28
'input' - unexpected token DonchianExpert.mq5 52 1
declaration of 'InfoPanel' hides global declaration at line 52 DonchianExpert.mq5 52 28
see previous declaration of 'InfoPanel' DonchianExpert.mq5 52 28
'input' - unexpected token DonchianExpert.mq5 55 1
declaration of 'DonchianPeriod' hides global declaration at line 55 DonchianExpert.mq5 55 28
see previous declaration of 'DonchianPeriod' DonchianExpert.mq5 55 28
'input' - unexpected token DonchianExpert.mq5 56 1
declaration of 'Extremes' hides global declaration at line 56 DonchianExpert.mq5 56 28
see previous declaration of 'Extremes' DonchianExpert.mq5 56 28
'input' - unexpected token DonchianExpert.mq5 59 1
declaration of 'CurStrategy' hides global declaration at line 59 DonchianExpert.mq5 59 28
see previous declaration of 'CurStrategy' DonchianExpert.mq5 59 28
'input' - unexpected token DonchianExpert.mq5 62 1
declaration of 'ADX_period' hides global declaration at line 62 DonchianExpert.mq5 62 28
see previous declaration of 'ADX_period' DonchianExpert.mq5 62 28
'input' - unexpected token DonchianExpert.mq5 63 1
declaration of 'ADX_level' hides global declaration at line 63 DonchianExpert.mq5 63 28
see previous declaration of 'ADX_level' DonchianExpert.mq5 63 28
'input' - unexpected token DonchianExpert.mq5 66 1
declaration of 'InpFastEMA' hides global declaration at line 66 DonchianExpert.mq5 66 28
see previous declaration of 'InpFastEMA' DonchianExpert.mq5 66 28
'input' - unexpected token DonchianExpert.mq5 67 1
declaration of 'InpSlowEMA' hides global declaration at line 67 DonchianExpert.mq5 67 28
see previous declaration of 'InpSlowEMA' DonchianExpert.mq5 67 28
'input' - unexpected token DonchianExpert.mq5 68 1
declaration of 'InpSignalSMA' hides global declaration at line 68 DonchianExpert.mq5 68 28
see previous declaration of 'InpSignalSMA' DonchianExpert.mq5 68 28
'input' - unexpected token DonchianExpert.mq5 69 1
declaration of 'InpAppliedPrice' hides global declaration at line 69 DonchianExpert.mq5 69 28
see previous declaration of 'InpAppliedPrice' DonchianExpert.mq5 69 28
'input' - unexpected token DonchianExpert.mq5 72 1
declaration of 'Inp_Bars' hides global declaration at line 72 DonchianExpert.mq5 72 28
see previous declaration of 'Inp_Bars' DonchianExpert.mq5 72 28
'input' - unexpected token DonchianExpert.mq5 73 1
declaration of 'Price' hides global declaration at line 73 DonchianExpert.mq5 73 28
see previous declaration of 'Price' DonchianExpert.mq5 73 28
'input' - unexpected token DonchianExpert.mq5 74 1
declaration of 'Trend_lev' hides global declaration at line 74 DonchianExpert.mq5 74 28
see previous declaration of 'Trend_lev' DonchianExpert.mq5 74 28
'input' - unexpected token DonchianExpert.mq5 77 1
declaration of 'RSIperiod1' hides global declaration at line 77 DonchianExpert.mq5 77 28
see previous declaration of 'RSIperiod1' DonchianExpert.mq5 77 28
'input' - unexpected token DonchianExpert.mq5 78 1
declaration of 'RSIperiod2' hides global declaration at line 78 DonchianExpert.mq5 78 28
see previous declaration of 'RSIperiod2' DonchianExpert.mq5 78 28
'input' - unexpected token DonchianExpert.mq5 79 1
declaration of 'RSIperiod3' hides global declaration at line 79 DonchianExpert.mq5 79 28
see previous declaration of 'RSIperiod3' DonchianExpert.mq5 79 28
'input' - unexpected token DonchianExpert.mq5 80 1
declaration of 'RSIperiod4' hides global declaration at line 80 DonchianExpert.mq5 80 28
see previous declaration of 'RSIperiod4' DonchianExpert.mq5 80 28
'input' - unexpected token DonchianExpert.mq5 81 1
declaration of 'Applied_price' hides global declaration at line 81 DonchianExpert.mq5 81 28
see previous declaration of 'Applied_price' DonchianExpert.mq5 81 28
'input' - unexpected token DonchianExpert.mq5 82 1
declaration of 'rsiUpperTrigger' hides global declaration at line 82 DonchianExpert.mq5 82 28
see previous declaration of 'rsiUpperTrigger' DonchianExpert.mq5 82 28
'input' - unexpected token DonchianExpert.mq5 83 1
declaration of 'rsiLowerTrigger' hides global declaration at line 83 DonchianExpert.mq5 83 28
see previous declaration of 'rsiLowerTrigger' DonchianExpert.mq5 83 28
'input' - unexpected token DonchianExpert.mq5 86 1
declaration of 'UseTrailing' hides global declaration at line 86 DonchianExpert.mq5 86 28
see previous declaration of 'UseTrailing' DonchianExpert.mq5 86 28
'input' - unexpected token DonchianExpert.mq5 87 1
declaration of 'VirtualTrailingStop' hides global declaration at line 87 DonchianExpert.mq5 87 28
see previous declaration of 'VirtualTrailingStop' DonchianExpert.mq5 87 28
'input' - unexpected token DonchianExpert.mq5 88 1
declaration of 'parameters_trailing' hides global declaration at line 88 DonchianExpert.mq5 88 28
see previous declaration of 'parameters_trailing' DonchianExpert.mq5 88 28
'input' - unexpected token DonchianExpert.mq5 90 1
declaration of 'TF_Tralling' hides global declaration at line 90 DonchianExpert.mq5 90 28
see previous declaration of 'TF_Tralling' DonchianExpert.mq5 90 28
'input' - unexpected token DonchianExpert.mq5 92 1
declaration of 'StepTrall' hides global declaration at line 92 DonchianExpert.mq5 92 28
see previous declaration of 'StepTrall' DonchianExpert.mq5 92 28
'input' - unexpected token DonchianExpert.mq5 93 1
declaration of 'StartTrall' hides global declaration at line 93 DonchianExpert.mq5 93 28
see previous declaration of 'StartTrall' DonchianExpert.mq5 93 28
'input' - unexpected token DonchianExpert.mq5 95 1
declaration of 'period_ATR' hides global declaration at line 95 DonchianExpert.mq5 95 28
see previous declaration of 'period_ATR' DonchianExpert.mq5 95 28
'input' - unexpected token DonchianExpert.mq5 97 1
declaration of 'step_PSAR' hides global declaration at line 97 DonchianExpert.mq5 97 28
see previous declaration of 'step_PSAR' DonchianExpert.mq5 97 28
'input' - unexpected token DonchianExpert.mq5 98 1
declaration of 'maximum_PSAR' hides global declaration at line 98 DonchianExpert.mq5 98 28
see previous declaration of 'maximum_PSAR' DonchianExpert.mq5 98 28
'input' - unexpected token DonchianExpert.mq5 100 1
declaration of 'ma_period' hides global declaration at line 100 DonchianExpert.mq5 100 28
see previous declaration of 'ma_period' DonchianExpert.mq5 100 28
'input' - unexpected token DonchianExpert.mq5 101 1
declaration of 'ma_method' hides global declaration at line 101 DonchianExpert.mq5 101 28
see previous declaration of 'ma_method' DonchianExpert.mq5 101 28
'input' - unexpected token DonchianExpert.mq5 102 1
declaration of 'applied_price' hides global declaration at line 102 DonchianExpert.mq5 102 28
see previous declaration of 'applied_price' DonchianExpert.mq5 102 28
'input' - unexpected token DonchianExpert.mq5 104 1
declaration of 'PercentProfit' hides global declaration at line 104 DonchianExpert.mq5 104 28
see previous declaration of 'PercentProfit' DonchianExpert.mq5 104 28
declaration of 'InpInd_Handle1' hides global declaration at line 106 DonchianExpert.mq5 106 10
see previous declaration of 'InpInd_Handle1' DonchianExpert.mq5 106 10
declaration of 'InpInd_Handle2' hides global declaration at line 106 DonchianExpert.mq5 106 25
see previous declaration of 'InpInd_Handle2' DonchianExpert.mq5 106 25
declaration of 'InpInd_Handle3' hides global declaration at line 106 DonchianExpert.mq5 106 40
see previous declaration of 'InpInd_Handle3' DonchianExpert.mq5 106 40
declaration of 'dcs_up' hides global declaration at line 107 DonchianExpert.mq5 107 10
see previous declaration of 'dcs_up' DonchianExpert.mq5 107 10
declaration of 'dcs_low' hides global declaration at line 107 DonchianExpert.mq5 107 19
see previous declaration of 'dcs_low' DonchianExpert.mq5 107 19
declaration of 'close' hides global declaration at line 107 DonchianExpert.mq5 107 29
see previous declaration of 'close' DonchianExpert.mq5 107 29
declaration of 'adx' hides global declaration at line 108 DonchianExpert.mq5 108 10
see previous declaration of 'adx' DonchianExpert.mq5 108 10
declaration of 'adx_m' hides global declaration at line 108 DonchianExpert.mq5 108 16
see previous declaration of 'adx_m' DonchianExpert.mq5 108 16
declaration of 'adx_p' hides global declaration at line 108 DonchianExpert.mq5 108 24
see previous declaration of 'adx_p' DonchianExpert.mq5 108 24
declaration of 'macd_m' hides global declaration at line 109 DonchianExpert.mq5 109 10
see previous declaration of 'macd_m' DonchianExpert.mq5 109 10
declaration of 'macd_s' hides global declaration at line 109 DonchianExpert.mq5 109 19
see previous declaration of 'macd_s' DonchianExpert.mq5 109 19
declaration of 'avs' hides global declaration at line 110 DonchianExpert.mq5 110 10
see previous declaration of 'avs' DonchianExpert.mq5 110 10
declaration of 'rsi_1b' hides global declaration at line 111 DonchianExpert.mq5 111 10
see previous declaration of 'rsi_1b' DonchianExpert.mq5 111 10
declaration of 'rsi_2b' hides global declaration at line 111 DonchianExpert.mq5 111 19
see previous declaration of 'rsi_2b' DonchianExpert.mq5 111 19
declaration of 'rsi_3b' hides global declaration at line 111 DonchianExpert.mq5 111 28
see previous declaration of 'rsi_3b' DonchianExpert.mq5 111 28
declaration of 'rsi_4b' hides global declaration at line 111 DonchianExpert.mq5 111 37
see previous declaration of 'rsi_4b' DonchianExpert.mq5 111 37
declaration of 'rsi_1s' hides global declaration at line 112 DonchianExpert.mq5 112 10
see previous declaration of 'rsi_1s' DonchianExpert.mq5 112 10
declaration of 'rsi_2s' hides global declaration at line 112 DonchianExpert.mq5 112 19
see previous declaration of 'rsi_2s' DonchianExpert.mq5 112 19
declaration of 'rsi_3s' hides global declaration at line 112 DonchianExpert.mq5 112 28
see previous declaration of 'rsi_3s' DonchianExpert.mq5 112 28
declaration of 'rsi_4s' hides global declaration at line 112 DonchianExpert.mq5 112 37
see previous declaration of 'rsi_4s' DonchianExpert.mq5 112 37
'OnInit' - function can be declared only in the global scope DonchianExpert.mq5 116 5
'OnInit' - function already defined and has body DonchianExpert.mq5 116 5
'OnDeinit' - function can be declared only in the global scope DonchianExpert.mq5 180 6
'OnDeinit' - function already defined and has body DonchianExpert.mq5 180 6
'OnTick' - function can be declared only in the global scope DonchianExpert.mq5 187 6
'OnTick' - function already defined and has body DonchianExpert.mq5 187 6
'OnChartEvent' - function can be declared only in the global scope DonchianExpert.mq5 215 6
'OnChartEvent' - function already defined and has body DonchianExpert.mq5 215 6
'BuySignal' - function can be declared only in the global scope DonchianExpert.mq5 225 6
'BuySignal' - function already defined and has body DonchianExpert.mq5 225 6
'SellSignal' - function can only be declared in the global scope DonchianExpert.mq5 256 6
'SellSignal' - function already defined and has body DonchianExpert.mq5 256 6
'GetIndValue' - function can be declared only in the global scope DonchianExpert.mq5 287 6
'GetIndValue' - function already defined and has body DonchianExpert.mq5 287 6

101 error(s), 66 warning(s) 100 67

and how to deal with it?

 
natyog:
can't open "C:\Program Files\RoboForex - MetaTrader 5\MQL5\include\EasyAndFastGUI\WndEvents.mqh" include file DonchianUI.mqh 6 11

and how to deal with it?

First of all, connect the EasyAndFastGUI library, as indicated in the last sentence of the article. But since there are difficulties with this, I attach the archive together with the library and materials of the article.
Files:
MQL5.zip  1816 kb
 
natyog:

101 error(s), 66 warning(s) 100 67

and how to deal with it?

Sorry for the inconvenience, the files to the article have been replaced. Please download them again and try to compile them.
 

Thanks for sharing! Gold 0.3 US dollars can return to the capital, there is a need to contact the user name WeChat whkh18

 

hi i'm trying to test Donchian Channels on MT5, but i need an Expert Advisor, i liked your article, but i can't create the Expert Advisor from your article

I've already downloaded the attached files, pasted them into the MT5 folder, but it doesn't appear in MT5. how do I do it? what's still missing?

 
Don't believe me, I created this channel without knowing about its existence ))))... probably, like me, I learnt it from Ishimoku.... but I approach it from a slightly different side, I consider trading inside the channel, using fibo levels with entry at 61 level and fixation of 161. On the period M5-M15. And a couple of pips on correction when reaching the 161 level.
 

Good morning!


I couldn't get it to work either!

 

The Ea has a critical error... You have to inform the programmer of the error and wait for him to resolve it.

 

I'm having trouble compiling this. Your code is advanced for me so I'm having a hard time figuring out how to fix it. Its these errors here:

'method' - undeclared identifier MenuItem.mqh 228 110

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

expression not boolean ChartCanvas.mqh 129 53


bool CMenuItem::CreateMenuItem(const long chart_id,const int subwin,const int index_number,const string label_text,const int x_gap,const int y_gap)
  {
//--- Exit if there is no pointer to the form
   if(!CElement::CheckWindowPointer())
      return(false);
//--- If there is no pointer to the previous node, then
//    an independent menu item is implied, that is the one that is not a part of a context menu
   if(::CheckPointer(m_prev_node)==POINTER_INVALID)
     {
      //--- Leave, if the set type does not match
      if(m_type_menu_item!=MI_SIMPLE && m_type_menu_item!=MI_HAS_CONTEXT_MENU)
        {
         ::Print(__FUNCTION__," > The type of the independent menu item can be only MI_SIMPLE or MI_HAS_CONTEXT_MENU,",
                 "that is only with a context menu.\n",
                 __FUNCTION__," > The type of the menu item can be set using the CMenuItem::TypeMenuItem()") method")";
         return(false);
        }
     }