Page 1 of 1

Count the instruments if....

Posted: Thu Jan 23, 2014 5:15 pm
by 872251950
Hello everyone,

Really confusing if there is a function to count instruments that meet certain criteria, maybe something like a countif function in Excel. Or is there a loop I could use to do counting? Let's say count how many contracts have ROC in close price greater than "0" ?

Here is my rough thought but I think something wrong with it.

Count= 0
For i= 1 to system.totalinstruments

if instrument.close(ROC)> 0 then
count=count+1
end if
next

Appreciate for any help.