Please help me. Why array out of range when I try to use iCustom for smaller timeframe. - page 2

 
kenny0779 #:

Because I still can't find the problem. :(

You are copying rates of D1 and using rates_total from a lower timeframe, How many M5 bars do you have in a Single D1 Bar for example?  It therefore means your LTF generally have more bars than the HTF. You are "Out of range" for the daily rates.

Place a check for when "pos" is equal to or greater than "rates-1"  from the daily TF.

 
Thank-god Avwerosuoghene Odukudu #:

You are copying rates of D1 and using rates_total from a lower timeframe, How many M5 bars do you have in a Single D1 Bar for example?  It therefore means your LTF generally have more bars than the HTF. You are "Out of range" for the daily rates.

Place a check for when "pos" is equal to or greater than "rates-1"  from the daily TF.

Thank god, this is one of the problem what I supposed. But I have no idea how to deal with it. By the way, why check for pos but not checking when i is equal or greater than rates_total-1 from daily time frame. Thx