pine-scriptcci

How to replicate Pinescript results from CCI?


I'm trying to understand the CCI script but I don't see it's usind the "High" and "Low" values to calculate the Typical Price as explaned in the The Formula for the Commodity Channel Index (CCI), is that right?


Solution

  • From the documentation:

    The CCI (commodity channel index) is calculated as the difference between the typical price of a commodity and its simple moving average, divided by the mean absolute deviation of the typical price. The index is scaled by an inverse factor of 0.015 to provide more readable numbers

    The "High" and "Low" values are not used for calculations CCI. I assume that you have confused the terms typical price and true range.

    [Addition]

    The pine script allows you to choose which series of calculations will be performed. Choose HLС3 in your case. enter image description here