What difference for use Bars and IndicatorCounted ?

 

How to choose or apply ?



Thank you

 

Bars : "Number of bars in the current chart."

IndicatorCounted : "The amount of bars not changed after the indicator had been launched last."

 
sorasit46: How to choose or apply ?

Look at ANY indicator in the codebase
#define LOOKBACK ma_period // Largest used in loop
int counted = IndicatorCounted();
if(counted < LOOKBACK) counted = LOOKBACK;
for(int iPos = Bars - 1 - counted; iPos >= 0; iPos--){
   buffer[iPos] = iMA( ... ma_period ... iPos); // Lookback==ma_period
   buffer[iPos] = ...  iPos+1);                 // Lookback==1
You use BOTH
 
Thank you
Reason: