High guys.
I am in the process of converting from Tradingview to Prorealtime but want to bring my strategy with me. Unfortunately however, Prorealtime does not have the indicators i use so i need to convert them. How do i go about doing that? Are there any conversion notes/articles i can read that will help me convert things like – “obv(src) => cum(change(src) > 0 ? volume : change (src) < 0 ? -volume : 0*volume)”. Creating the variables such as src and volume is straight forward, it’s the other bits i’m having issues with.
Any help would be greatly appreciated. I would be happy to code it myself if there is any helpful guidance.
Thanks in advance
There you go:
Periods = 20
MyOBV = OBV(close)
Sma = Average[Periods,0](MyOBV)
Diff = MyOBV - Sma
RETURN Diff AS "Difference"
Thanks Roberto.
It looks like the conversion has been simplified as it doesn’t produce the same output as the original.
I have attached a screen shot of the original in the hope that it helps.
Thanks again for your assistance.
I needed to see screenshots and as you had not posted any link I found this one OBV Oscillator
I see some code was appended at a later moment. Can you provide a link to that code and pic, so that I can find details about its purpose?
There you go:
// OBV Oscillator2
//
// On Balance Volume Oscillator
//
// https://www.tradingview.com/script/Ox9gyUFA-Indicator-OBV-Oscillator/
// https://www.prorealcode.com/topic/conversion-of-pine-script-obv-osc-0-1/
//
// It makes easier to detect DIVERGENCES
//
// Periods = 20
// Periods2 = 14
Periods = max(1,min(999,Periods))
Periods2 = max(1,min(999,Periods2))
//
MyOBV = OBV(close)
ma1 = 0
IF BarIndex > max(Periods,Periods2) THEN
Sma = Average[Periods,0](MyOBV)
Diff = MyOBV - Sma
// --- added later:
// (https://www.prorealcode.com/topic/conversion-of-pine-script-obv-osc-0-1/#post-177572)
Sma = Average[Periods,0](MyOBV)
Diff = MyOBV - Sma
//////////////////////////////////
ONCE wmaPERC = 1 / Periods2
ONCE maP = max(1,round(exp(0.5*log(Periods2))))
//
ma1 = (Diff * wmaPERC) + (ma1[1] * (1 - wmaPERC)) //Wilder Average 1
//ma1 = ((ma1[1] * (Periods2 - 1)) + Diff) / Periods2 //Wilder Average 2
//
ma2 = average[maP,0](ma1)
r = 255 //Orange
g = 100
b = 10
IF ma1 > ma2 THEN
r = 20 //Cyan
g = 150
b = 255
ENDIF
ma3 = ma1 * exp(0.15*log(Periods2))
//DrawText("•",BarIndex,Ma3,Dialog,Bold,10) coloured(r,g,b,255)
// --- end additional code
ENDIF
RETURN Diff AS "Difference",ma3 AS "ma3"
Thanks Roberto
I’m going to have a play with this today.
Thanks again.