why prev_calculated - 1?

 

hello guys,

   I have been thinking over days already, it seems that for all indicators, any counter with i = prev_calculated could do more than fine as it points towards the previous candle which is already a calculated figure. why bother to do i = prev_calculated - 1 at all?

  actually it seems to me that if prev_calculated really mean previously calculated, then we should even set i = prev_calculated + 1 for our calculation in OnCalculate()... Why not?

Bosco 

 
boscomanilow128:

hello guys,

   I have been thinking over days already, it seems that for all indicators, any counter with i = prev_calculated could do more than fine as it points towards the previous candle which is already a calculated figure. why bother to do i = prev_calculated - 1 at all?

  actually it seems to me that if prev_calculated really mean previously calculated, then we should even set i = prev_calculated + 1 for our calculation in OnCalculate()... Why not?

Bosco 

Can you post at least one example of code.
 

this article mightbe helpful: Creation of Custom Indicators

Creation of Custom Indicators - Simple Programs in MQL4 - MQL4 Tutorial
  • book.mql4.com
Creation of Custom Indicators - Simple Programs in MQL4 - MQL4 Tutorial
Reason: