Optex Show Bar Script


Using this very simple Optex script but it is not showing expected results as highlighted in the attached screen shot, expecting upturns in the red circles to be highlighted by the Show Bar.

//In lower band and turns up
//Use as Show Bar 
V1 = OPTEX();
C1 = V1.Ratio < V1.25Lower;
C2 = V1.Ratio TurnsUp;
C1 and C2

Thanks Tim.

It’s because the the TurnsUp signal will always be a day after the bottom, and in your example the day after the turn the V1.Ratio is above V1.25Lower, so the C1 condition is false, hence no signal.

You can see when we do get a signal that the day after the turn is still within the band:


All you need to do to fix the formula is look at the C1 condition on the previous day, when the low was within the band. Use this as the last line, where [1] is the
previous day.

C1[1] and C2

Changing the Show Bar to a line over all views now captures those signals:


Hi Darren,

Thanks. I hadn’t come across this condition before in my scripting, well worth knowing.