How to use OHLC data in "for" loops?
For example, suppose you want to add up Open values in the last 50 bars (Decussate).
I think the answer is:
double S=0;
for( int i=0 ;i<50 ; i++)
if (i%2==0) S=S+Open[i];
Value[0]=S;
(Note that the above example has no specific logic and is just an example. You can implement any other logic in the loop.)
-----------
BUT!
In any loop, you can not use expressions such as Open[i] or Bars.GetOpen(i) or Open.GetValueAt(i), etc. (None of them worked for me.)
My question is simple. How can calculations be performed on the last few bars that cannot be performed with the default functions(Such as MAX , MIN , SUM , etc ) and require a "for" loop to write them manually?

Comment