Hello Folks
Can anyone tell me if it is possible to find the barindex value based on a function (i.e. barindex of lowest[10](low))
Currently, I have to measure and compare each bar with the function output in order to find and identify the bar index of a specific function.
Yes, apart doing loops, there is no function/instruction to do that. I asked IT Finance about adding this kind of instruction, don’t know when it will be available.
Thank you for the prompt reply Nicolas.
Currently, I am using loops was just hoping there was an easier way
Bro how do I found the bar index using loops?
You can do something like this to find your lowest low in the previous 10 bars barindex.
myindex = 0
lowestlow = low
for a = 0 to 9
if low[a] <= lowestlow then
lowestlow = low[a]
myindex = a
endif
next
graph myindex
…or you can do something like this which works slightly faster as it does not need to complete each loop if the lowest low is found earlier in the run.
myindex = 0
for a = 0 to 9
if low[a] = lowest[10](low) then
myindex = a
break
endif
next
graph myindex