is there a way to make iBarShift to return indexes from left to right?
I like to work with Arrays where 0 means the oldest bar, butiBarShift return it the other way round.
Test case in OnCalculate:
for(int bar_number=prev_calculated; bar_number<rates_total;
bar_number++)
{
datetime bar_time = time[bar_number]; //first iteration - bar_number 0, time - the oldest bar (in my case sometime in 2017)int bar_number_h4=iBarShift(Symbol(),PERIOD_H4,bar_time,false);
int bar_number_d1 = iBarShift(Symbol(),PERIOD_D1, bar_time, true);
int bar_number_m15= iBarShift(Symbol(),PERIOD_M15,bar_time,false);
}
In next iterations - bar number goes: 0,1,2,3,4,5
Time increases:
D'2017.04.28 14:00:00'
D'2017.04.28 15:00:00'
D'2017.04.28 16:00:00'
But bar_number_h4 i starting on a big number and getting lower: 3402, 3401, 3400...
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Hi,
is there a way to make iBarShift to return indexes from left to right?
I like to work with Arrays where 0 means the oldest bar, butiBarShift return it the other way round.
Test case in OnCalculate:
In next iterations - bar number goes: 0,1,2,3,4,5
Time increases:
D'2017.04.28 14:00:00'
D'2017.04.28 15:00:00'
D'2017.04.28 16:00:00'
But bar_number_h4 i starting on a big number and getting lower: 3402, 3401, 3400...
Could you help?