Donchian channels coding help

Hi everyone,

I know it’s much to ask, but maybe someone has some spare time

Can someone help me with an EA for below strategy?

Indicator: Donchian Channel

1 Like

Hi :slight_smile:
What is the rule for oder 1 ?

Greets

Hi,

Breakout of Donchian channel

To create the channel you need to a have a look back of ‘n’ periods. For example if you are looking at an hourly chart you would need to look back 20 or 10 periods back in time from the present bar. The high point of the channel is the highest point of the ‘n’ periods and conversely the lowest point for the ‘n’ periods. Whatever software you are using should have a function for looking back in time and then grouping on that time frame. You can ask the group function for the maximum (high) and the minimum (low) of those ‘n’ periods. That is your high and low for the channel. While I dont know what software you are using this is the general idea.

Hi,

You did perfectly described Donchian channel indicator…this is what the indicator does: shown the higher and lower of ‘n’ periods.

The idea above is to enter at the breakout of this highest and lowest points.

I think I may have missed the mark on what you are asking.

It sounds like you want to incorporate the Donchian Channel into your EA.

What you can do is add the Bollinger band study to your EA since highs and lows by themselves have little meaning. However, when the highs and lows are relative to standard deviation then you can extract important information. There is a system that incorporates these two indicators.

I think you’re better off hiring someone

I’ve already written first version and shared with OP. Adding it here if anyone would like to play around:
DonAVGD.ex4 (28.8 KB)

Parameters:
input double POSITION_SIZE = 0.01; - self explanatory - set position size for grid of trades
input int LOOKBACK_PERIOD = 20; - period for Donchian Channel
input int NUM_OF_STEPS = 30; - How many pending orders open
input int STEP_SIZE = 100; - step size in PIPS
input int TP = 10; - amount in account currency to close automatically all trades. If you have some trades open and total profit is equal TP - all trades will be closed automatically, set 0 to allow manual close