Good evening all,
Please can you help to convert this indicator on Trading View – https://www.tradingview.com/script/2Ssn4yDZ-Two-Pole-Oscillator-BigBeluga/
Many thanks.
Good evening,
Have you tried it ?
If not, here what you can expect…
Thanks, yes I have tried it and I think it works well identifying oversold or overbought areas.
Hi. here it is:
//---------------------------------------------//
//PRC_Two Pole oscillator
//version = 0
//10.02.2025
//Iván González @ www.prorealcode.com
//Sharing ProRealTime knowledge
//---------------------------------------------//
// inputs
//---------------------------------------------//
length=20 // filter length
dispLevels= 1 // display levels?
prd=25 // moving average periods
//---------------------------------------------//
// source calculation
//---------------------------------------------//
sma1=average[prd](close)
smaN1=((close-sma1)-average[prd](close-sma1))/std[prd](close-sma1)
area=average[100](high-low)
//---------------------------------------------//
// Oscillator
//---------------------------------------------//
source=smaN1
alpha=2/(length+1)
if barindex<max(prd*2,length) then
smooth1=source
smooth2=smooth1
else
smooth1=(1-alpha)*smooth1+alpha*source
smooth2=(1-alpha)*smooth2+alpha*smooth1
endif
twoP=smooth2
twoPP=twoP[4]
//---------------------------------------------//
// Colors
//---------------------------------------------//
if twoP>twoPP then
r=85
g=255
b=218
else
r=140
g=91
b=255
endif
//---------------------------------------------//
// Signals
//---------------------------------------------//
buySignal=twoP crosses over twoPP and twoP<0
sellSignal=twoP crosses under twoPP and twoP>0
if buysignal then
drawpoint(barindex[1],twoP[1],2)coloured(r,g,b)
drawpoint(barindex[1],twoP[1],5)coloured(r,g,b,100)
elsif sellSignal then
drawpoint(barindex[1],twoP[1],2)coloured(r,g,b)
drawpoint(barindex[1],twoP[1],5)coloured(r,g,b,100)
endif
//---------------------------------------------//
return twoP coloured(r,g,b)style(line,2), 1 coloured("grey",100), 0.5 coloured("grey",100), 0 coloured("black")style(dottedline3), -1 coloured("grey",100), -0.5 coloured("grey",100)
Thanks Ivan. Thats great.