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.
Cheers,
EA based on DonchianADX
- krzysiekqq2
- Trader
- Posts: 69
- Joined: Sun Oct 11, 2015 11:59 am
- Location: Gdynia, town at Baltic sea cost
EA based on DonchianADX
You do not have the required permissions to view the files attached to this post.
- renexxxx
- Trader
- Posts: 860
- Joined: Sat Dec 31, 2011 3:48 am
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:
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
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:
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:
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
i.e. replace NULL with Symbol() and 0 with Period(), to indicate the current symbol on the current timeframe
Hope this helps.
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);
Code: Select all
double Buy2_2 = iCustom(NULL, 0, "Doda-Donchian_v2_mod_fix", 2, Current + 0);
Similarly line 83 becomes:
Code: Select all
double Sell2_2 = iCustom(NULL, 0, "Doda-Donchian_v2_mod_fix", 2, Current + 0);
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);
Code: Select all
double Sell2_2 = iCustom(Symbol(), Period(), "Doda-Donchian_v2_mod_fix", 2, Current + 0);
Hope this helps.
- krzysiekqq2
- Trader
- Posts: 69
- Joined: Sun Oct 11, 2015 11:59 am
- Location: Gdynia, town at Baltic sea cost
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,
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,