Hi
I’m trying to right a screener which looks for overbought or oversold conditions but I’m not sure if one screener can be used to achieve this.
I want it to display either overbought or oversold so I know which is which if that makes sense.
I have included the code but I’m not sure it works as is.
Thanks
Rob
// Overbought maybe
hh = highest[30](high)
MyRSI = RSI[5]
c1 = high[1] = hh
c2 = MyRSI > 70
Overbought = c1 AND c2
// Oversold maybe
ll = lowest[30](low)
c4 = low[1] = ll
c5 = MyRSI < 30
Oversold = c4 AND c5
Screener[Overbought or Oversold]
Try
// Overbought maybe
hh = highest[30](high)
MyRSI = RSI[5]
c1 = high[1] = hh
c2 = MyRSI > 70
Overbought = c1 AND c2
// Oversold maybe
ll = lowest[30](low)
c4 = low[1] = ll
c5 = MyRSI < 30
Oversold = c4 AND c5
x=0
If OverBought THEN
x=1
Elsif OverSold THEN
x=2
ENDIF
Screener[x]
Thanks. modified it slightly, seems to work now. Thank you Roberto!
// Overbought maybe
hh = highest[30](high)
MyRSI = RSI[5]
c1 = high[1] = hh
c2 = MyRSI > 70
Overbought = c1 AND c2
// Oversold maybe
ll = lowest[30](low)
c4 = low[1] = ll
c5 = MyRSI < 30
Oversold = c4 AND c5
x=0
If OverBought THEN
x=70
Elsif OverSold THEN
x=30
ENDIF
Screener[x](x as "Result")