stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

EA based on DonchianADX
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=4558
Page 1 of 1
Author:  krzysiekqq2 [ Tue Dec 29, 2015 9:19 pm ]
Post subject:  EA based on DonchianADX

HI, I just completed my 1st EA using EA builder, but can not get Donchian Indi to be visible and is causing error. I replaced MidLine with MA, but this is not what I want to have and what I use in manual trading. Strategy is to take a trade, when bar cross Donchian MidLine and and close above. This needs to be in line with ADX and DI+/- proper position. Exit from position is when ADX will reverse on next closed bar. Preferably, system is run on Renko chart.

I want to add later additional positions when trend breaks 15 bars low/high represented by horizontal lines like in Turtle strategy.

I would appreciate you suggestion how to improve coding to get Donchian Indi MidLine to be readable.
EURUSDM2.png
Buy_DD_Sell_ADX_MA_EA_v2.mq4
Buy_DD_Sell_ADX_EA_v2.mq4
Doda-Donchian_v2_mod_fix.mq4
Cheers,
Author:  renexxxx [ Fri Jan 01, 2016 3:17 am ]
Post subject:  EA based on DonchianADX

This question is about the use of the iCustom-function, to interrogate the custom indicator "Doda-Donchian_v2_mod_fix".

Your code in Buy_DD_Sell_ADX_EA_v2.mq4, line 72:

Code: Select all

double Buy2_2 = iCustom(NULL, 0, "Doda-Donchian_v2_mod_fix", MedLine, 12, Current + 0);
won't work (or even compile as the MedLine variable is not defined). You need to decide what parameters you wish to pass to the "Doda-Donchian_v2_mod_fix"-indicator. If you are happy with its default parameters, you can get away with

Code: Select all

double Buy2_2 = iCustom(NULL, 0, "Doda-Donchian_v2_mod_fix", 2, Current + 0);
The 2 (before Current + 0) refers to the buffer number. As you are after the MidLine buffer, which is the third buffer, you use the buffer index of 2.

Similarly line 83 becomes:

Code: Select all

double Sell2_2 = iCustom(NULL, 0, "Doda-Donchian_v2_mod_fix", 2, Current + 0);
Note that you do need to get the name of the indicator correct. Your code in line 83 said: "Doda-Donchian2". Empty4 is not smart enough to induce that you mean "Doda-Donchian_v2_mod_fix".

If, on the contrary you wish to supply non-default parameters to the "Doda-Donchian_v2_mod_fix"-indicator, you need to list each of them separately on the iCustom-call. Something like:

Code: Select all

double Buy2_2 = iCustom(NULL, 0, "Doda-Donchian_v2_mod_fix", 24, 120,  6, 0, 0.32,  true, clrBlack, 26, 1, clrBlue, clrBlue, clrBlue, clrBlue, 2, Current + 0);
These are the default parameter, but you can change each of them as required. As an additional guide, I find it more intuitive to use

Code: Select all

double Sell2_2 = iCustom(Symbol(), Period(), "Doda-Donchian_v2_mod_fix", 2, Current + 0);
i.e. replace NULL with Symbol() and 0 with Period(), to indicate the current symbol on the current timeframe

Hope this helps.
Author:  krzysiekqq2 [ Fri Jan 01, 2016 3:21 pm ]
Post subject:  EA based on DonchianADX

Many thanks renexxxx.
Your points/comments are very valuable. I started mglbook to get brief understanding of coding. I have a long way to go to before creating workable EA.
Happy New Year and Cheers,
All times are UTC Page 1 of 1