Topic: Donchian channel

Hi Popov and other readers

I generated a strategy on Expert Advisor Studio which uses Donchian channels (19) as exit. The exit rule indicator for a buy reads: "The bar opens above upper band after opening below it." And vice versa for a short.

The strategy tested fine on MT4 strategy tester and avg holding period period is less than 2 days on the strategy tester.

However, when trading strategy live, the trades do not close and stay open forever.

Can you please look at the MQL code generated by the software. I believe there must be something wrong with the OrderClose function.

Thank you

Re: Donchian channel

Perhaps you can attach the EA so that people can examine it.

My 'secret' goal is to push EA Studio until I can net 3000 pips per day....

Re: Donchian channel

Sure. I attached the code. Hopefully the error can be resolved.

Post's attachments

Donchian system.mq4 18.18 kb, 6 downloads since 2019-07-25 

You don't have the permssions to download the attachments of this post.

Re: Donchian channel

Everything looks fine on the backtest. Do you have any errors or warning in the MT's "Expert" or "Journal" pages?

You run the EA on the correct market - EURUSD M5, right? 

I'll put it on a demo on M1 on several charts to see if there are any problems.

Re: Donchian channel

It opened and closed a position.

Anyway, because EA Studio trades only at Bar open, Donchian Channel may rise open or close signal only when there is a gap above the previous max High or below the previous lowest Low. It happens rarely. That's why I made the indicator "not recomended".

Post's attachments

donchian-system-close-on-profit.png
donchian-system-close-on-profit.png 3.92 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Re: Donchian channel

Thank you for the testing and feedback. :-)

Re: Donchian channel

   double ind1upBand1 = ind1Up1;
   double ind1dnBand1 = ind1Dn1;
   double ind1upBand2 = ind1Up2;
   double ind1dnBand2 = ind1Dn1;
   bool ind1long  = Open(0) > ind1upBand1 + sigma && Open(1) < ind1upBand2 - sigma;
   bool ind1short = Open(0) < ind1dnBand1 - sigma && Open(1) > ind1dnBand2 + sigma;

Line 4 above must be wrong because it's not symmetrical. That should be

   double ind1dnBand2 = ind1Dn2;

Donchian channel strategy normally just needs a break-out not a gap-out. So you should use High and Low instead of Open. So I would suggest the signals be

   bool ind1long  = High(0) > ind1upBand1 + sigma && High(1) < ind1upBand2 - sigma;
   bool ind1short = Low(0) < ind1dnBand1 - sigma && Low(1) > ind1dnBand2 + sigma;

This way, Donchian should be fine for use.

Re: Donchian channel

I'll check that!