I was just wondering if it is possible to create a do loop with multiple conditions because the documentation only show a do loop with one condition ?
count = 0
for i = 1 to 4 do
x = low < Low[i] and high > high[i]
if x then
count = count +1
endif
next
return count
count = 0
for i = 1 to 4 do
x = low < Low[i] and high > high[i]
xx=dayOpen[1]-dayOpen[2]
if x and xx then
count = count +1
endif
next
return count
You can certainly do that, provided you write line 6 correctly:
xx=dOpen(1)-dOpen(2)
unfortunately testing XX at line 8 makes no sense, since it will ALWAYS be true; whether positive or negative there will always be (well… it’s not 100% granted, but it’s quite rare otherwise) a difference in price between the opening of two different days!
Sure you can do that, you can add any other codes in a loop, even another loop. Coding with loops is the main subject of the advanced programming course.