how do you calculate 4 times the 20 day sma of obv. this does not seem to be working
myOBV = OBV(close)
avgOBV=average[20](myOBV) * 4
JSParticipant
Veteran
That way you multiply (myOBV) by four…
Try this:
myOBV=OBV(close)
avgOBV=average[20](myOBV)
avgOBV4=avgOBV * 4
thanks for reply JS but it does not seem to work. How can I spit out the value so I can see what is wrong. When check results on a chart is not meeting the criteria.
JSParticipant
Veteran
It’s nothing more than calculating a “moving average” (which happens well here) and then multiplying the outcome by four…
Can’t go wrong? 🙂
Can you show your graph…
avgOBV=average[20](myOBV) * 4 actually multiplies the average, not OBV as 4 times OBV would be avgOBV=average[20](myOBV * 4).
Anyway, it might depend on other conditions requiring more than 256 units.
Are you using other conditions?
You can simply create this indicator to spot the values returned:
myAVG = avgOBV=average[20](myOBV)
myAVG4 = avgOBV=average[20](myOBV) * 4
return myAVG AS "average[20](myOBV)",myAVG4 AS "average[20](myOBV) * 4"
basically I want a screener that returns stocks that the current OBV is 4 times the 20 day sma of obv
JSParticipant
Veteran
Hi Roberto,
It doesn’t matter if you first multiply the OBV by four and then calculate the average or if you multiply the average by four, the result is the same…
Average[20](myOBV)*4 = Average[20](myOBV*4)
(Why more than 256 units…?)
JSParticipant
Veteran
Hi Samd,
Over what period do you want to calculate the OBV?
IF he has more conditions that exceed 256 bars the calculations could be affected. Just guessing.
I got your explanation aboyt the multiplier 🙂