Hi Nicolas, I would ask if already exist or in case do not exist if is it possible to create an indicator that calculate for any candle, the distance between price and a pre-definite moving average (Exponential or simple). In this way we could have a new simple indication of overbought or oversold. Thanks for your help and regards, Ivan
JSParticipant
Senior
Hi Ivan,
Maybe this is a start…
Period=14
Type=0 //0=SMA 1=EMA
MA=Average[Period,Type](Close)
For i=0 to Period-1
If Close[i]>MA[i] then
xUp=Close[i]-MA[i]
Else
xDown=MA[i]-Close[i]
EndIf
Next
AvgxUp=Average[Period](xUp)
AvgxDown=Average[Period](xDown)
DrawHLine(70)Coloured("Red")
DrawHLine(30)Coloured("Green")
OBOS=100-(100/(1+AvgxUp/AvgxDown))
Return OBOS as "OBOS"
I had wondered about this too, being new to code and all.
Managed to get this to work on a FTSE counter trend long scalp 5min. See where it goes.
Thanks!