I'm trying to convert a TradingView strategy onto NT8 and struggling to port over a for loop that I'd used - hoping someone may please have an example snippet of a for loop to illustrate how it should be done.
Here's the code I've tried that is throwing an error of "cannot apply indexing with [] to an expression of type 'double'". It's within OnBarUpdate: It is trying to loop through the last 15 bars to see if each bars Close Price meets a variable (myVarOne & myVarTwo), which are and need to be doubles), and essentially counts them (aka how many of the last 15 bars did the close price equal variable X?).
for (int i = 0; i < 15; i++) { if (Close[i] == myVarOne[i]) { //do something } if (Close[i] == myVarTwo[i]) { //do something }
Many thanks in advance
ChainsawDR
Comment