If I want to fill the array called "arr[]" with the last 10 values of Low[] looking back from the CurrentBar, would the following work
int len = 10; protected override void OnBarUpdate() { if (CurrentBar<len) return; size=0; for (int i=CurrentBar-len; i<=CurrentBar; i++) { arr[size]=Low[i]; //may not work for 10-bar look back from, bar 63 (i=53,54,...,62) size+=1; }
Or should I loop backward to pull values of Low[0], Low[1], etc, like this:
size=0; for (int i=CurrentBar-len; i<=CurrentBar; i++) { arr[size]=Low[size]; //this would always fetch Low[0],Low[1],etc size+=1; }
for (int i=CurrentBar-len; i<=CurrentBar-1; i++) { arr[size]=Low[size]; size+=1; }
Comment