Download MetaTrader 5
To add comments, please log in or register
Make profit on MQL5 services. It's easy!
Rafal
7
Rafal 2014.06.26 04:22 

Hi. At first I would like to say hello to everyone as it is my firs post ;)

I have a question, which I can not find answer for few days already :(


Is there any way to obtain amount of bars between two bars. I mean something like iBarShift() function with two arguments.

Alternatively how to obtain "shift" value for x bar instead of 0 bar in a chart . Something like iBarShift() for 1,2,3,4 bar.

Thanks.

luis
23
luis 2014.06.26 08:17  

How do you identify your 2 bars? Maybe with timestamps?


datetime some_time1 = D'2004.03.21 12:00';
datetime some_time2 = D'2004.03.21 12:30';

int         shift_1 = iBarShift("EUROUSD",PERIOD_M1,some_time1);
int         shift_2 = iBarShift("EUROUSD",PERIOD_M1,some_time2);

int        distance = shift_1 - shift_2;
Rafal
7
Rafal 2014.06.29 06:10  

Worked great.

Thanks.

/
To add comments, please log in or register