Help undestanding indicators

coiler
284

Hi All,

i am starting understanding and coding indicators and i am a little confused... i've seen inside the code of and indicator that calculates a weekly pivot point this line

 

last_week_high = Close[i+1];

 i don't understand why this line is not this other one:

last_week_high = iLow(Symbol(),PERIOD_W1,1)

 

How Close[i+1] is retrieving the last week high?.

Could you help me to understand how series work inside indicator code?

Regards. 

William Roeder
25815
William Roeder  
coiler: How Close[i+1] is retrieving the last week high?.
It can't. Even it i+1 was the bar (current timeframe) what was last week's high.
Simon Gniadkowski
17409
coiler:

Hi All,

i am starting understanding and coding indicators and i am a little confused... i've seen inside the code of and indicator that calculates a weekly pivot point this line 

 i don't understand why this line is not this other one:

How Close[i+1] is retrieving the last week high?.

Could you help me to understand how series work inside indicator code?

If the code is wrong many things are possible . . .
Alain Verleyen
42602
coiler:

Hi All,

i am starting understanding and coding indicators and i am a little confused... i've seen inside the code of and indicator that calculates a weekly pivot point this line

 

 i don't understand why this line is not this other one:

 

How Close[i+1] is retrieving the last week high?.

Could you help me to understand how series work inside indicator code?

Regards. 

Close[x] retrieve the close price of candle x on the current chart. That can't return the high (unless close = high).

iLow(Symbol(),PERIOD_W1,1)

gives you the low of last week (independtly of any chart). Use iHigh for the high.

An indicator is calculated on historical data, so you have a loop with an index (i) and you have to add 1 (i+1) to find to high of previous candle.

Either the indicator is buggy, or you misunderstood it. If you need more help post the code.