- Claudio Lasso: I'm coding an EA on mql4.Why did you post your MT4 question in the Root / MT5 General section instead of the MQL4 section, (bottom of the Root page?)
General rules and best pratices of the Forum. - General - MQL5 programming forum
Next time post in the correct place. The moderators will likely move this thread there soon. -
iADX(NULL,PERIOD_D1
On MT4: Unless the current chart is that specific pair/TF referenced, you must handle 4066/4073 errors before accessing candle/indicator values.
Download history in MQL4 EA - Forex Calendar - MQL4 programming forum - Page 3 #26 № 4 - Don't use NULL.
- You can use NULL in place of _Symbol only in those calls that the documentation specially says you can. iHigh does, iCustom does, MarketInfo does not. OrderSend does not.
- Don't use NULL (except for pointers where you explicitly check for it.) Use _Symbol and _Period, that is minimalist as possible and more efficient.
- Zero is the same as PERIOD_CURRENT which means _Period. Don't hard code numbers.
- MT4: No need for a function call with iHigh(NULL,0,s) just use the predefined arrays, i.e. High[].
- Why did you post your MT4 question in the Root / MT5 General
section instead of the MQL4 section, (bottom of the Root page?)
General rules and best pratices of the Forum. - General - MQL5 programming forum
Next time post in the correct place. The moderators will likely move this thread there soon. - On MT4: Unless the current chart is that specific pair/TF referenced, you must handle 4066/4073
errors before accessing candle/indicator values.
Download history in MQL4 EA - Forex Calendar - MQL4 programming forum - Page 3 #26 № 4
hI William sorry I don't pay attention how I posted...sorry to much
You say don't use NULL....but if I go in the webpage of
iADX (
https://docs.mql4.com/indicators/iadx)..they use it

- docs.mql4.com
I'm coding an EA on mql4. I need to sum 2 iADX...
Hi @lippmaje,
I'd like to define an iADX value
as a medium value of the ADX value of the past 2 days.
I use this EA on a graph of a 1M TF..My strategy is based on movement on 1M TF. It opens trade only if there are some condition on D1 TF.
Now
William Roeder tells
that I must download the history of that TF but i really don't know how to do..any help will be appreciate. Thanks a lot
The medium of two values is formed by (val1+val2)/2 this holds also for ADX.
Your EA will run on M1 timeframe, that means D1 timeframe data may yet not be available when the EA runs.
MQL is event oriented that means when you request history data such as D1 - which is seen as 'foreign' by your M1 EA - it may not be served instantly, but the data request will cause all sort of spooky things going on in the background so that a few milliseconds later it may be ready to be retrieved.
Write a new bar
function so that on every new minute you're going to retrieve that D1 data, and use it in OnTick, not OnInit. This assures you'll
eventually succeed in retrieving that data. Combine it with an initialization flag to prevent redundant calls.

- www.mql5.com
Do you see words with underlines?
Those are links. They take you to more information. You would
know how, had you bothered to click on the provided link.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I'm coding an EA on mql4. I need to sum 2 iADX. Could you tell me if is this code correct?
Thanks a lot