Category: Indicator > Volume Based
The On Balance Volume indicator adds to a running total the volume of each bar with a higher close than the bar before and subtracts from the total the volume of each bar with a lower close. The running total is plotted as a line.
The use of both price and volume provides a different perspective from price or volume alone. For example, higher prices with light volume will cause On Balance Volume to rise slowly, possibly indicating that the trend lacks conviction. Because On Balance Volume begins accumulating values from the left of the chart, the numeric value of On Balance Volume will depend on the data available in the chart. Therefore, the relative value, or trend direction, of On Balance Volume is more important than its numeric value.
IF HIGH > HIGHEST(HIGH, 20) AND OBV < HIGHEST(OBV, 20) THEN
ALERT("A BEARISH DIVERGENCE HAS BEEN DETECTED")
IF LOW < LOWEST(LOW, 20) AND OBV > LOWEST(OBV, 20) THEN
ALERT("A BULLISH DIVERGENCE HAS BEEN DETECTED");