is there a bug here in the arrayminimum?
i copy 3 slots only but when i call arrayminimum with start pos at 2 for 3 count it can still return something...
And where is the bug ? You have 3 elements with index 0, 1, 2. ArrayMinimum takes only the index 2 into account and always return Bar_Close[2].
start pos is 2 meaning index 1 right?
I was thinking it will read to index 3 but there is no error generated.
start pos is 2 meaning index 1 right?
I was thinking it will read to index 3 but there is no error generated.
Your Bar_Close has 3 values Bar_Close[0] which is current candle close as you are using ArraySetAsSeries (true). Bar_Close[1] and Bar_Close[2].
You search the minimum starting with 2, and count 3. So it search within Bar_Close[2], Bar_Close[3], Bar_Close[4], but indices 3 and 4 doesn't exist so you always get Bar_Close[2] as result. There is no error, no bug.
Not right.
Your Bar_Close has 3 values Bar_Close[0] which is current candle close as you are using ArraySetAsSeries (true). Bar_Close[1] and Bar_Close[2].
You search the minimum starting with 2, and count 3. So it search within Bar_Close[2], Bar_Close[3], Bar_Close[4], but indices 3 and 4 doesn't exist so you always get Bar_Close[2] as result. There is no error, no bug.
Understand. Thanks.
but why is there still a return from the arrayminimum if I use this
int Shift = ArrayMinimum(Bar_Close, 5, 3);
Understand. Thanks.
but why is there still a return from the arrayminimum if I use this
Print() Bar_Close[0], Bar_Close[1], Bar_Close[2], Bar_Close[3], Bar_Close[4], Bar_Close[5], Bar_Close[6], Bar_Close[7] and find out what is going on.
void OnTick() { //--- double Bar_Close[]; if(CopyClose(_Symbol, 0, 0, 3, Bar_Close) <= 0) return; ArraySetAsSeries(Bar_Close, true); int Shift = ArrayMinimum(Bar_Close, 0, 2); Print("Minimal close price = ",Bar_Close[Shift]," for ",Shift," bar"); //--- }You copy 3 elements starting from element with index 0 (zero), so 1st element have index 0 in array Bar_Close, 2nd element = index 1, and finally 3rd = index 2.
LOL, you are searching a bug ? I check...

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
is there a bug here in the arrayminimum?
i copy 3 slots only but when i call arrayminimum with start pos at 2 for 3 count it can still return something...