Using of command iClose with shift parameter

 

What is the shift parameter for? It was explained as

" Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago). "

which i could not understand what it means?

Say i was to get the value of previous bar closing price, i should use -1, 0 for current bar and 1 for next 1 bar? Is this correct?

 
zactan:

What is the shift parameter for? It was explained as

" Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago). "

which i could not understand what it means?

Say i was to get the value of previous bar closing price, i should use -1, 0 for current bar and 1 for next 1 bar? Is this correct?

-1 ? NO.

You are right for the other one. Say on one minute chart, close price for current time is

iClose (Symbol () Period(), 0);

Close price 1 minute ago ...

iClose (Symbol () Period(), 1);

Close price 2 minute ago ...

iClose (Symbol () Period(), 2);

and so on ...

:)

 
onewithzachy:

-1 ? NO.

You are right for the other one. Say on one minute chart, close price for current time is

Close price 1 minute ago ...

Close price 2 minute ago ...

and so on ...

:)


Nice explanation......

Only bar 0 is not closed yet and this value is changing till it is.... Now it is same as Bid price of the Symbol()

 
deVries:


Nice explanation......

Only bar 0 is not closed yet and this value is changing till it is.... Now it is same as Bid price of the Symbol()

Right, or Close [0].

Dumb me :( I should also mention that iClose is the way to get close price of any bar not just from current chart but also from different Symbol and/or different time frame.

:(

Supposed we're in 15 minutes GBPJPY and wants to know 1 minute EURUSD

iClose ("EURUSD", PERIOD_M1, 0); // bar 0
iClose ("EURUSD", PERIOD_M1, 1); // bar 1
iClose ("EURUSD", PERIOD_M1, 2); // bar 2
// and so on ...
Reason: