The only optional arguments to the iCustom function are the extern variables of that indicator. If you don't specify any of its externs, the defautls will be used. Other than that, all arguments are required. As for the shifts, here it is in a visual example:
.
2BarsAgo|1BarAgo|CurrentBarBeingFormed
their shift values are like so:
2|1|0
.
All non-0 candles will be static since they are in the past and the past doesn't change.
.
Jon
Thank you both for the replies.
Here is what I don't understand.
I put 0 value in the indicator. Now I do not get a result.
In the other indicator, I put 0 aswell, but it is anoter buffer. This one does work.
Any ideas ?
Hi BB
What do you mean it doesn't? What doesn't work? If the value returned is 21848834 or something then the buffer is empty or does it crash?
Hi BB
What do you mean it doesn't? What doesn't work? If the value returned is 21848834 or something then the buffer is empty or does it crash?
When I put 0 in shift, there are no values returned for buffer 0
When I put 1 in shift, there are values returned for buffer 0
However, in both cases, values are returned for buffer 1
BB
Maybe you have an indi that gives a signal at the close of the current bar and doesn't calculate the current bar (Current bar is shift=0)...
When I put 0 in shift, there are no values returned for buffer 0
When I put 1 in shift, there are values returned for buffer 0
However, in both cases, values are returned for buffer 1
BB
What is no value? An error? Perhaps it would be better to show us the indicator then we could fix it.
I'd say your comments are correct. I have found the bug in my code. I forgot a "-1" sign, in the piece of code
Counted_bars=IndicatorCounted(); i=Bars-Counted_bars-1; while(i>=0)
My apologies for this
For future reference, when using a custom indicator and you want to find the index of the buffer, open up the code and go in the init() function to find it. If the line you want values from is green, you can follow the color to find that it's written in buffer 3 and get the value from that index in the EA. You can also get it by hovering over the line in MT4 and subtracting 1. Value1 would be buffer 0 for example. This only works if the coder didn't set a specific label for it. If he named it "Green Line", you won't know if it's value1 unless you look around in the properties.
.
Jon
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
With iCustom, it only seems to work when I put the last parameter(shift) as 1. If I leave it, it don't work.
What does shift do ?
Thanks