You should realise that bar number 0 is always in the process of being formed, and you should, in my opinion, never ever attempt to us it for indicator readings. You may use bar open, because that won't change, but bar close as well as high and low will or may change as new tick comes in, until that bar becomes bar number 1 (when a new bar number 0 begins being developed).
Therefore, I would suggest that you change the last argument in the iCustom calls to 1.
You should realise that bar number 0 is always in the process of being formed, and you should, in my opinion, never ever attempt to us it for indicator readings. You may use bar open, because that won't change, but bar close as well as high and low will or may change as new tick comes in, until that bar becomes bar number 1 (when a new bar number 0 begins being developed). Therefore, I would suggest that you change the last argument in the iCustom calls to 1.
thanks for suggestion, it sounds plausibly
but the value is still the same
Yes, your are right; my concern was different.
The value you see is the EMPTY value, i.e. that there is no value assigned for the indicator at the bar. From looking at the code, apparently the indicator only assigns value at the bars where the arrows appear, and leav the value as EMPTY otherwise.
It could make sense to add "SetIndexEmptyValue(0,0);" and "SetIndexEmptyValue(1,0);" in the init() function, and thereby define the unassigned value to read as 0.
Yes, your are right; my concern was different.
The value you see is the EMPTY value, i.e. that there is no value assigned for the indicator at the bar. From looking at the code, apparently the indicator only assigns value at the bars where the arrows appear, and leav the value as EMPTY otherwise.
It could make sense to add "SetIndexEmptyValue(0,0);" and "SetIndexEmptyValue(1,0);" in the init() function, and thereby define the unassigned value to read as 0.you are right - it works
but the value is not at the same time as the indi draws the arrow,
not even similarly
you are right - it works
but the value is not at the same time as the indi draws the arrow,
not even similarly
Which simulation mode do you use? "every tick" or "open bars only"?
What do you mean more exactly? How do you observe the timing difference between that an arrow is placed and that your EA notices it?
Which simulation mode do you use? "every tick" or "open bars only"? What do you mean more exactly? How do you observe the timing difference between that an arrow is placed and that your EA notices it?
i'm using "every tick"
for example
look at the attachement and compare it with the journal:
24.01.2007 - 25.01.2007 EURUSD H1
SIGNAL 1 short
14:04:05 2007.01.24 15:00 ADX_CROSSES_ICUSTOM EURUSD,H1: _____________________________value2 1.3027
...
...
...
14:04:05 2007.01.24 15:59 ADX_CROSSES_ICUSTOM EURUSD,H1: _____________________________value2 1.3027
SIGNAL 2 long
14:04:05 2007.01.25 08:01 ADX_CROSSES_ICUSTOM EURUSD,H1: _____________________________value1 1.2938
...
...
...
14:04:05 2007.01.25 08:59 ADX_CROSSES_ICUSTOM EURUSD,H1: _____________________________value1 1.2938
SIGNAL 3 short
14:04:05 2007.01.25 15:18 ADX_CROSSES_ICUSTOM EURUSD,H1: _____________________________value2 1.3007
...
...
...
14:04:05 2007.01.25 15:59 ADX_CROSSES_ICUSTOM EURUSD,H1: _____________________________value2 1.3007
SIGNAL 5 short
14:04:05 2007.01.25 17:32 ADX_CROSSES_ICUSTOM EURUSD,H1: _____________________________value2 1.3001
...
...
...
14:04:05 2007.01.25 17:59 ADX_CROSSES_ICUSTOM EURUSD,H1: _____________________________value2 1.3001
SIGNAL 6 long
14:04:05 2007.01.25 18:08 ADX_CROSSES_ICUSTOM EURUSD,H1: _____________________________value1 1.294
...
...
...
14:04:05 2007.01.25 18:59 ADX_CROSSES_ICUSTOM EURUSD,H1: _____________________________value1 1.294
Signal 7 long
14:04:05 2007.01.25 19:00 ADX_CROSSES_ICUSTOM EURUSD,H1: _____________________________value1 1.2957
...
...
...
14:04:05 2007.01.25 19:59 ADX_CROSSES_ICUSTOM EURUSD,H1: _____________________________value1 1.2957
3 signals in the chart and 7 in the journal
it works sometimes but not everytime
thank u very much
I'm just bookmarking this for now, I will get back to you as to whatelse you can use for confirmation, I trade manually so I hope you can incorporate in your alert.
Ok; firstly, of course, the displayed indicator is a different instance of that indicator from the instance that the EA uses. You would like them to present the same indications, but they don't, for a relatively simple but highly technical reason; namely that they are invoked in different ways.
If we fast-forward past the long-winded explanation, you end up with the concern I brought up initially; namely that through the EA, the indicator is queried again and again and with changing result while the most recent bar is being built. In particular, it makes signals as soon as the condition holds, even if it doesn't hold when the bar is complete.
The displayed indicator appears to only use the completed bar data.
Actually from looking mor closely at the code, I think the combined indicator is doubly weird in that it for bar 0 pulls iADX values relating to the close of bar -1 as well as close of bar 0. Does iADX predict bar close that well? The close of bar -1 is almost 2 hours from now, at least when bar 0 is just started.
Basically "close of bar 0" is the always changing "last tick price", until this bar becomes bar 1. And bar -1 is a figment of imagination whose close price is (highly?) uncertain.
Thus, as I understand it, the combined indicator should be changed to not set signals on bars 1 and 0, but it should set it on bar 2 (if the condition holds). As a consequence, the EA can only discover such a signal 2 bars behind, i.e. 1 hour after the close of the bar that is marked; i.e., it should look for the bar 2 signal.
Ok; firstly, of course, the displayed indicator is a different instance of that indicator from the instance that the EA uses. You would like them to present the same indications, but they don't, for a relatively simple but highly technical reason; namely that they are invoked in different ways.
If we fast-forward past the long-winded explanation, you end up with the concern I brought up initially; namely that through the EA, the indicator is queried again and again and with changing result while the most recent bar is being built. In particular, it makes signals as soon as the condition holds, even if it doesn't hold when the bar is complete.
The displayed indicator appears to only use the completed bar data.
Actually from looking mor closely at the code, I think the combined indicator is doubly weird in that it for bar 0 pulls iADX values relating to the close of bar -1 as well as close of bar 0. Does iADX predict bar close that well? The close of bar -1 is almost 2 hours from now, at least when bar 0 is just started.
Basically "close of bar 0" is the always changing "last tick price", until this bar becomes bar 1. And bar -1 is a figment of imagination whose close price is (highly?) uncertain.
Thus, as I understand it, the combined indicator should be changed to not set signals on bars 1 and 0, but it should set it on bar 2 (if the condition holds). As a consequence, the EA can only discover such a signal 2 bars behind, i.e. 1 hour after the close of the bar that is marked; i.e., it should look for the bar 2 signal.Yes, i think thats the error, i'm very grateful to you.
but i must confess that i doesn't understand how the indi works exactly (newbe) - if i would know i would have coded the main function from the indi into my EA
I think your meaning of the problem is the right one, but the proposal for solution (2. bars) destroys the profits.
maybe i could use the filefunctions to write the signal of the indi into a file and get it from the file by EA.
but i think it doesn't work because the indi and EA would have to run at the same time in backtest and it sounds not realizable .
Do you have any other ideas?
Thank you very much for your help!

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
hi @ all
in front of all - sorry for my bad english
i used the ADXcrosses indi i attached, on h1/h4 EURUSD and have a lot of profit in metatrader demo account.
now i tryed to code an EA for backtest...
i try to realize it with icustom() (only 2 buffers)
//----
double value1=iCustom(NULL, 0, "ADXcrosses",50,0,0);
double value2=iCustom(NULL, 0, "ADXcrosses",50,1,0);
//----
but it only gives the same value for both buffers every time --> 2147483647
the ADXcrosses uses arrows as signals and no lines could this be the
source of error?
did anybody know?
i will be grateful for every help.