Summary: This indicator script measures the cumulative flow of volume / money into and out of an underlying symbol. Calculation: The cumulative sum of the volume of the underlying symbol times the close location value, CLV = ((C-L) - (H-C)) / (H-L). Developer: Marc Chaikin Interpretation: 1. Upwards Trend: When the indicator script is moving upwards, the underlying symbol is in an upwards trend. 2. Downwards Trend: When the indicator script is moving downwards, the underlying symbol is in a downwards trend. 3. Positive Divergence: When the underlying symbol is moving downwards, but the indicator script is moving upwards, the underlying symbol is likely to reverse direction and move upwards. 4. Negative Divergence: When the underlying symbol is moving upwards, but the indicator script is moving downwards, the underlying symbol is likely to reverse direction and move downwards.
' Initialize the indicator as an index indicator. IndicatorIndex(symbolIndex) ' Assign the parameter to a script variable. _symbolIndex = symbolIndex
' Get the highest prices of the symbol, indexed by bar index. Define high() As Number = BarHigh(_symbolIndex, barIndex, length) ' Get the lowest prices of the symbol, indexed by bar index. Define low() As Number = BarLow(_symbolIndex, barIndex, length) ' Get the closing prices of the symbol, indexed by bar index. Define close() As Number = BarClose(_symbolIndex, barIndex, length) ' Get the volume values of the symbol, indexed by bar index. Define volume() As Number = BarVolume(_symbolIndex, barIndex, length) ' Get the last Accumulation/Distribution Line value. Define AD As Number = IndicatorIndexValue() ' Use for the numerator value. Define numerator As Number = 0 ' Use for the denominator value. Define denominator As Number = 0 ' Use for the calculated Accumulation/Distribution Line values, indexed by bar index. Define results(length - 1) As Number ' Calculate the Accumulation/Distribution Line values for the specified bar range. For i As Integer = length - 1 To 0 Step -1 ' Calculate the Accumulation/Distribution Line value for the current bar. numerator = (close(i) - low(i)) - (high(i) - close(i)) denominator = high(i) - low(i) If (denominator <> 0) Then AD += (numerator / denominator) * volume(i) End If ' Assign the Accumulation/Distribution Line value for the current bar. results(i) = AD Next Return results