Is there a way to really omit the sunday candle so it doesn’t increase the barindex? I would want friday to be say bar index 1000 and then monday shall be 1001 and not 1002 because of the sunday candle.
Make your own barindex counting only if we are not on Sunday:
if open[0]<>lastopen and opendayofweek<>0 then
lastopen = open[0]
mybarindex=mybarindex+1
endif
return mybarindex
This was a good idea Nicolas but will not work for addressing a special bar. If I for example need the close 25 of my bars (without sundays) back
c=close[myindex-25]
will give wrong results. One would also have to count how many sundays where omitted and then add this number when addressing a bar because PRT internally still counts the sundays. :-S
Another question, do you have a good idea how to check if the underlying in question has a sunday bar? I’m working on an indicator that counts bars but it shall not count sundays. It works nice on assets that have no sunday bar but if there is a sunday bar it becomes wrong.
Just test if your security has a opendayofweek=0, if not, there is no Sunday.