Look at your indicator code:
b4plusdi = iADX(NULL, 0, ADXcrossesPeriod, PRICE_CLOSE, MODE_PLUSDI, i - 1);
in mt4 it means you are using the next future bar (x-1) to decide what to do now - try to understand this!
Carl Schreiber:
Oh snap... Basically that means, that there is no way to calculate same way as in indicator except for delaying until the next bar is created in ea, right?
Look at your indicator code:
in mt4 it means you are using the next future bar (x-1) to decide what to do now - try to understand this!
The indicator is coded in a bad manner - don't copy that!
In mt4 (see Docs!) e.g. Time[0] means the actual bar (which is changing) Time[0] is the open-time.
Time[1] is the previous bar's (open) time and Time[0-1] does not exists acc. to a negative index.
That's how the time/quote series are defined in mt4.
But of course 'future times' are possible like Time[0] + 3*_Period*60 - e.g. to place an object.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi guys!
I have encountered problem with the iADX lag with daily chart. Basically I have created ea for daily bars based on adx indicator.
And here's my ea:
Problem is that on daily chart while using indicator I see buy signal at 00:00 time, example:
2016.01.01 00:00
2016.01.02 00:00 buy
2016.01.03 00:00
2016.01.04 00:00
But when using my ea I get buy signal way too late (and I expect it to open buy position @ 2016.01.03 00:00):
2016.01.01 00:00
2016.01.02 00:00
2016.01.03 19:02 buy
2016.01.04 00:00
What should I do to force my ea to open buy position @ 2016.01.02 00:00? I know I could use iADX shift 2 and 1 instead of 1 and 0, but this lags by whole DAY as in:
2016.01.01 00:00
2016.01.02 00:00
2016.01.03 00:00
2016.01.04 00:00 buy